1/* Copyright JS Foundation and other contributors, http://js.foundation
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#include "js-parser-internal.h"
17
18JERRY_STATIC_ASSERT ((sizeof (cbc_uint8_arguments_t) % sizeof (jmem_cpointer_t)) == 0,
19                     sizeof_cbc_uint8_arguments_t_must_be_divisible_by_sizeof_jmem_cpointer_t);
20
21JERRY_STATIC_ASSERT ((sizeof (cbc_uint16_arguments_t) % sizeof (jmem_cpointer_t)) == 0,
22                     sizeof_cbc_uint16_arguments_t_must_be_divisible_by_sizeof_jmem_cpointer_t);
23
24#if ENABLED (JERRY_PARSER)
25
26/** \addtogroup parser Parser
27 * @{
28 *
29 * \addtogroup jsparser JavaScript
30 * @{
31 *
32 * \addtogroup jsparser_bytecode Bytecode
33 * @{
34 */
35
36/**
37 * Compact bytecode definition
38 */
39#define CBC_OPCODE(arg1, arg2, arg3, arg4) \
40  ((arg2) | (((arg3) + CBC_STACK_ADJUST_BASE) << CBC_STACK_ADJUST_SHIFT)),
41
42/**
43 * Flags of the opcodes.
44 */
45const uint8_t cbc_flags[] JERRY_ATTR_CONST_DATA =
46{
47  CBC_OPCODE_LIST
48};
49
50/**
51 * Flags of the extended opcodes.
52 */
53const uint8_t cbc_ext_flags[] =
54{
55  CBC_EXT_OPCODE_LIST
56};
57
58#undef CBC_OPCODE
59
60#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
61
62#define CBC_OPCODE(arg1, arg2, arg3, arg4) #arg1,
63
64/**
65 * Names of the opcodes.
66 */
67const char * const cbc_names[] =
68{
69  CBC_OPCODE_LIST
70};
71
72/**
73 * Names of the extended opcodes.
74 */
75const char * const cbc_ext_names[] =
76{
77  CBC_EXT_OPCODE_LIST
78};
79
80#undef CBC_OPCODE
81
82#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
83
84/**
85 * @}
86 * @}
87 * @}
88 */
89
90#endif /* ENABLED (JERRY_PARSER) */
91