Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: runtime/vm/regexp_bytecodes.h

Issue 1201383002: Port irregexp bytecode compiler and interpreter from V8 r24065. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/regexp_assembler_ir.cc ('k') | runtime/vm/regexp_interpreter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #ifndef VM_REGEXP_BYTECODES_H_
6 #define VM_REGEXP_BYTECODES_H_
7
8 namespace dart {
9
10 const int BYTECODE_MASK = 0xff;
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
13 // positive values.
14 const unsigned int MAX_FIRST_ARG = 0x7fffffu;
15 const int BYTECODE_SHIFT = 8;
16
17 #define BYTECODE_ITERATOR(V) \
18 V(BREAK, 0, 4) /* bc8 */ \
19 V(PUSH_CP, 1, 4) /* bc8 pad24 */ \
20 V(PUSH_BT, 2, 8) /* bc8 pad24 offset32 */ \
21 V(PUSH_REGISTER, 3, 4) /* bc8 reg_idx24 */ \
22 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_REGISTER_TO_SP, 6, 4) /* bc8 reg_idx24 */ \
25 V(SET_SP_TO_REGISTER, 7, 4) /* bc8 reg_idx24 */ \
26 V(SET_REGISTER, 8, 8) /* bc8 reg_idx24 value32 */ \
27 V(ADVANCE_REGISTER, 9, 8) /* bc8 reg_idx24 value32 */ \
28 V(POP_CP, 10, 4) /* bc8 pad24 */ \
29 V(POP_BT, 11, 4) /* bc8 pad24 */ \
30 V(POP_REGISTER, 12, 4) /* bc8 reg_idx24 */ \
31 V(FAIL, 13, 4) /* bc8 pad24 */ \
32 V(SUCCEED, 14, 4) /* bc8 pad24 */ \
33 V(ADVANCE_CP, 15, 4) /* bc8 offset24 */ \
34 V(GOTO, 16, 8) /* bc8 pad24 addr32 */ \
35 V(LOAD_CURRENT_CHAR, 17, 8) /* bc8 offset24 addr32 */ \
36 V(LOAD_CURRENT_CHAR_UNCHECKED, 18, 4) /* bc8 offset24 */ \
37 V(LOAD_2_CURRENT_CHARS, 19, 8) /* bc8 offset24 addr32 */ \
38 V(LOAD_2_CURRENT_CHARS_UNCHECKED, 20, 4) /* bc8 offset24 */ \
39 V(LOAD_4_CURRENT_CHARS, 21, 8) /* bc8 offset24 addr32 */ \
40 V(LOAD_4_CURRENT_CHARS_UNCHECKED, 22, 4) /* bc8 offset24 */ \
41 V(CHECK_4_CHARS, 23, 12) /* bc8 pad24 uint32 addr32 */ \
42 V(CHECK_CHAR, 24, 8) /* bc8 pad8 uint16 addr32 */ \
43 V(CHECK_NOT_4_CHARS, 25, 12) /* bc8 pad24 uint32 addr32 */ \
44 V(CHECK_NOT_CHAR, 26, 8) /* bc8 pad8 uint16 addr32 */ \
45 V(AND_CHECK_4_CHARS, 27, 16) /* bc8 pad24 uint32 uint32 addr32 */ \
46 V(AND_CHECK_CHAR, 28, 12) /* bc8 pad8 uint16 uint32 addr32 */ \
47 V(AND_CHECK_NOT_4_CHARS, 29, 16) /* bc8 pad24 uint32 uint32 addr32 */ \
48 V(AND_CHECK_NOT_CHAR, 30, 12) /* bc8 pad8 uint16 uint32 addr32 */ \
49 V(MINUS_AND_CHECK_NOT_CHAR, 31, 12) /* bc8 pad8 uc16 uc16 uc16 addr32 */ \
50 V(CHECK_CHAR_IN_RANGE, 32, 12) /* bc8 pad24 uc16 uc16 addr32 */ \
51 V(CHECK_CHAR_NOT_IN_RANGE, 33, 12) /* bc8 pad24 uc16 uc16 addr32 */ \
52 V(CHECK_BIT_IN_TABLE, 34, 24) /* bc8 pad24 addr32 bits128 */ \
53 V(CHECK_LT, 35, 8) /* bc8 pad8 uc16 addr32 */ \
54 V(CHECK_GT, 36, 8) /* bc8 pad8 uc16 addr32 */ \
55 V(CHECK_NOT_BACK_REF, 37, 8) /* bc8 reg_idx24 addr32 */ \
56 V(CHECK_NOT_BACK_REF_NO_CASE, 38, 8) /* bc8 reg_idx24 addr32 */ \
57 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_GE, 41, 12) /* bc8 reg_idx24 value32 addr32 */ \
60 V(CHECK_REGISTER_EQ_POS, 42, 8) /* bc8 reg_idx24 addr32 */ \
61 V(CHECK_AT_START, 43, 8) /* bc8 pad24 addr32 */ \
62 V(CHECK_NOT_AT_START, 44, 8) /* bc8 pad24 addr32 */ \
63 V(CHECK_GREEDY, 45, 8) /* bc8 pad24 addr32 */ \
64 V(ADVANCE_CP_AND_GOTO, 46, 8) /* bc8 offset24 addr32 */ \
65 V(SET_CURRENT_POSITION_FROM_END, 47, 4) /* bc8 idx24 */
66
67 #define DECLARE_BYTECODES(name, code, length) \
68 static const int BC_##name = code;
69 BYTECODE_ITERATOR(DECLARE_BYTECODES)
70 #undef DECLARE_BYTECODES
71
72 #define DECLARE_BYTECODE_LENGTH(name, code, length) \
73 static const int BC_##name##_LENGTH = length;
74 BYTECODE_ITERATOR(DECLARE_BYTECODE_LENGTH)
75 #undef DECLARE_BYTECODE_LENGTH
76
77 } // namespace dart
78
79 #endif // VM_REGEXP_BYTECODES_H_
OLDNEW
« no previous file with comments | « runtime/vm/regexp_assembler_ir.cc ('k') | runtime/vm/regexp_interpreter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698