OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef RUNTIME_VM_REGEXP_BYTECODES_H_ | 5 #ifndef RUNTIME_VM_REGEXP_BYTECODES_H_ |
6 #define RUNTIME_VM_REGEXP_BYTECODES_H_ | 6 #define RUNTIME_VM_REGEXP_BYTECODES_H_ |
7 | 7 |
8 namespace dart { | 8 namespace dart { |
9 | 9 |
10 const int BYTECODE_MASK = 0xff; | 10 const int BYTECODE_MASK = 0xff; |
11 // The first argument is packed in with the byte code in one word, but so it | 11 // The first argument is packed in with the byte code in one word, but so it |
12 // has 24 bits, but it can be positive and negative so only use 23 bits for | 12 // has 24 bits, but it can be positive and negative so only use 23 bits for |
13 // positive values. | 13 // positive values. |
14 const unsigned int MAX_FIRST_ARG = 0x7fffffu; | 14 const unsigned int MAX_FIRST_ARG = 0x7fffffu; |
15 const int BYTECODE_SHIFT = 8; | 15 const int BYTECODE_SHIFT = 8; |
16 | 16 |
| 17 // clang-format off |
17 #define BYTECODE_ITERATOR(V) \ | 18 #define BYTECODE_ITERATOR(V) \ |
18 V(BREAK, 0, 4) /* bc8 */ \ | 19 V(BREAK, 0, 4) /* bc8 */ \ |
19 V(PUSH_CP, 1, 4) /* bc8 pad24 */ \ | 20 V(PUSH_CP, 1, 4) /* bc8 pad24 */ \ |
20 V(PUSH_BT, 2, 8) /* bc8 pad24 offset32 */ \ | 21 V(PUSH_BT, 2, 8) /* bc8 pad24 offset32 */ \ |
21 V(PUSH_REGISTER, 3, 4) /* bc8 reg_idx24 */ \ | 22 V(PUSH_REGISTER, 3, 4) /* bc8 reg_idx24 */ \ |
22 V(SET_REGISTER_TO_CP, 4, 8) /* bc8 reg_idx24 offset32 */ \ | 23 V(SET_REGISTER_TO_CP, 4, 8) /* bc8 reg_idx24 offset32 */ \ |
23 V(SET_CP_TO_REGISTER, 5, 4) /* bc8 reg_idx24 */ \ | 24 V(SET_CP_TO_REGISTER, 5, 4) /* bc8 reg_idx24 */ \ |
24 V(SET_REGISTER_TO_SP, 6, 4) /* bc8 reg_idx24 */ \ | 25 V(SET_REGISTER_TO_SP, 6, 4) /* bc8 reg_idx24 */ \ |
25 V(SET_SP_TO_REGISTER, 7, 4) /* bc8 reg_idx24 */ \ | 26 V(SET_SP_TO_REGISTER, 7, 4) /* bc8 reg_idx24 */ \ |
26 V(SET_REGISTER, 8, 8) /* bc8 reg_idx24 value32 */ \ | 27 V(SET_REGISTER, 8, 8) /* bc8 reg_idx24 value32 */ \ |
(...skipping 30 matching lines...) Expand all Loading... |
57 V(CHECK_NOT_REGS_EQUAL, 39, 12) /* bc8 regidx24 reg_idx32 addr32 */ \ | 58 V(CHECK_NOT_REGS_EQUAL, 39, 12) /* bc8 regidx24 reg_idx32 addr32 */ \ |
58 V(CHECK_REGISTER_LT, 40, 12) /* bc8 reg_idx24 value32 addr32 */ \ | 59 V(CHECK_REGISTER_LT, 40, 12) /* bc8 reg_idx24 value32 addr32 */ \ |
59 V(CHECK_REGISTER_GE, 41, 12) /* bc8 reg_idx24 value32 addr32 */ \ | 60 V(CHECK_REGISTER_GE, 41, 12) /* bc8 reg_idx24 value32 addr32 */ \ |
60 V(CHECK_REGISTER_EQ_POS, 42, 8) /* bc8 reg_idx24 addr32 */ \ | 61 V(CHECK_REGISTER_EQ_POS, 42, 8) /* bc8 reg_idx24 addr32 */ \ |
61 V(CHECK_AT_START, 43, 8) /* bc8 pad24 addr32 */ \ | 62 V(CHECK_AT_START, 43, 8) /* bc8 pad24 addr32 */ \ |
62 V(CHECK_NOT_AT_START, 44, 8) /* bc8 pad24 addr32 */ \ | 63 V(CHECK_NOT_AT_START, 44, 8) /* bc8 pad24 addr32 */ \ |
63 V(CHECK_GREEDY, 45, 8) /* bc8 pad24 addr32 */ \ | 64 V(CHECK_GREEDY, 45, 8) /* bc8 pad24 addr32 */ \ |
64 V(ADVANCE_CP_AND_GOTO, 46, 8) /* bc8 offset24 addr32 */ \ | 65 V(ADVANCE_CP_AND_GOTO, 46, 8) /* bc8 offset24 addr32 */ \ |
65 V(SET_CURRENT_POSITION_FROM_END, 47, 4) /* bc8 idx24 */ | 66 V(SET_CURRENT_POSITION_FROM_END, 47, 4) /* bc8 idx24 */ |
66 | 67 |
67 #define DECLARE_BYTECODES(name, code, length) \ | 68 // clang-format on |
68 static const int BC_##name = code; | 69 |
| 70 #define DECLARE_BYTECODES(name, code, length) static const int BC_##name = code; |
69 BYTECODE_ITERATOR(DECLARE_BYTECODES) | 71 BYTECODE_ITERATOR(DECLARE_BYTECODES) |
70 #undef DECLARE_BYTECODES | 72 #undef DECLARE_BYTECODES |
71 | 73 |
72 #define DECLARE_BYTECODE_LENGTH(name, code, length) \ | 74 #define DECLARE_BYTECODE_LENGTH(name, code, length) \ |
73 static const int BC_##name##_LENGTH = length; | 75 static const int BC_##name##_LENGTH = length; |
74 BYTECODE_ITERATOR(DECLARE_BYTECODE_LENGTH) | 76 BYTECODE_ITERATOR(DECLARE_BYTECODE_LENGTH) |
75 #undef DECLARE_BYTECODE_LENGTH | 77 #undef DECLARE_BYTECODE_LENGTH |
76 | 78 |
77 } // namespace dart | 79 } // namespace dart |
78 | 80 |
79 #endif // RUNTIME_VM_REGEXP_BYTECODES_H_ | 81 #endif // RUNTIME_VM_REGEXP_BYTECODES_H_ |
OLD | NEW |