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

Side by Side Diff: src/bytecodes-irregexp.h

Issue 18363: * Irregexp: Move from a byte-oriented bytecode format to a 32-bit oriented... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/interpreter-irregexp.cc » ('j') | src/regexp-macro-assembler-irregexp-inl.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 13 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 28
29 #ifndef V8_BYTECODES_IRREGEXP_H_ 29 #ifndef V8_BYTECODES_IRREGEXP_H_
30 #define V8_BYTECODES_IRREGEXP_H_ 30 #define V8_BYTECODES_IRREGEXP_H_
31 31
32 namespace v8 { namespace internal { 32 namespace v8 { namespace internal {
33 33
34
35 static const int BYTECODE_MASK = 0xff;
36 static const unsigned int MAX_FIRST_ARG = 0xffffffu;
37 static const int BYTECODE_SHIFT = 8;
38
34 #define BYTECODE_ITERATOR(V) \ 39 #define BYTECODE_ITERATOR(V) \
35 V(BREAK, 0, 1) /* break */ \ 40 V(BREAK, 0, 4) /* bc8 */ \
Christian Plesner Hansen 2009/01/20 14:22:17 Why not count in whole words?
Erik Corry 2009/01/20 18:49:55 Unfortunately, the Label class counts in bytes and
36 V(PUSH_CP, 1, 5) /* push_cp offset32 */ \ 41 V(PUSH_CP, 1, 4) /* bc8 pad24 */ \
37 V(PUSH_BT, 2, 5) /* push_bt addr32 */ \ 42 V(PUSH_BT, 2, 8) /* bc8 pad24 offset32 */ \
38 V(PUSH_REGISTER, 3, 2) /* push_register register_index */ \ 43 V(PUSH_REGISTER, 3, 4) /* bc8 reg_idx24 */ \
39 V(SET_REGISTER_TO_CP, 4, 6) /* set_register_to_cp register_index offset32 */ \ 44 V(SET_REGISTER_TO_CP, 4, 8) /* bc8 reg_idx24 offset32 */ \
40 V(SET_CP_TO_REGISTER, 5, 2) /* set_cp_to_registger register_index */ \ 45 V(SET_CP_TO_REGISTER, 5, 4) /* bc8 reg_idx24 */ \
41 V(SET_REGISTER_TO_SP, 6, 2) /* set_register_to_sp register_index */ \ 46 V(SET_REGISTER_TO_SP, 6, 4) /* bc8 reg_idx24 */ \
42 V(SET_SP_TO_REGISTER, 7, 2) /* set_sp_to_registger register_index */ \ 47 V(SET_SP_TO_REGISTER, 7, 4) /* bc8 reg_idx24 */ \
43 V(SET_REGISTER, 8, 6) /* set_register register_index value32 */ \ 48 V(SET_REGISTER, 8, 8) /* bc8 reg_idx24 value32 */ \
44 V(ADVANCE_REGISTER, 9, 6) /* advance_register register_index value32 */ \ 49 V(ADVANCE_REGISTER, 9, 8) /* bc8 reg_idx24 value32 */ \
45 V(POP_CP, 10, 1) /* pop_cp */ \ 50 V(POP_CP, 10, 4) /* bc8 pad24 */ \
46 V(POP_BT, 11, 1) /* pop_bt */ \ 51 V(POP_BT, 11, 4) /* bc8 pad24 */ \
47 V(POP_REGISTER, 12, 2) /* pop_register register_index */ \ 52 V(POP_REGISTER, 12, 4) /* bc8 reg_idx24 */ \
48 V(FAIL, 13, 1) /* fail */ \ 53 V(FAIL, 13, 4) /* bc8 pad24 */ \
49 V(SUCCEED, 14, 1) /* succeed */ \ 54 V(SUCCEED, 14, 4) /* bc8 pad24 */ \
50 V(ADVANCE_CP, 15, 5) /* advance_cp offset32 */ \ 55 V(ADVANCE_CP, 15, 4) /* bc8 offset24 */ \
51 V(GOTO, 16, 5) /* goto addr32 */ \ 56 V(GOTO, 16, 8) /* bc8 pad24 addr32 */ \
52 V(LOAD_CURRENT_CHAR, 17, 9) /* load offset32 addr32 */ \ 57 V(LOAD_CURRENT_CHAR, 17, 8) /* bc8 offset24 addr32 */ \
53 V(LOAD_CURRENT_CHAR_UNCHECKED, 18, 5) /* load offset32 */ \ 58 V(LOAD_CURRENT_CHAR_UNCHECKED, 18, 4) /* bc8 offset24 */ \
54 V(LOAD_2_CURRENT_CHARS, 19, 9) /* load offset32 addr32 */ \ 59 V(LOAD_2_CURRENT_CHARS, 19, 8) /* bc8 offset24 addr32 */ \
55 V(LOAD_2_CURRENT_CHARS_UNCHECKED, 20, 5) /* load offset32 */ \ 60 V(LOAD_2_CURRENT_CHARS_UNCHECKED, 20, 4) /* bc8 offset24 */ \
56 V(LOAD_4_CURRENT_CHARS, 21, 9) /* load offset32 addr32 */ \ 61 V(LOAD_4_CURRENT_CHARS, 21, 8) /* bc8 offset24 addr32 */ \
57 V(LOAD_4_CURRENT_CHARS_UNCHECKED, 22, 5) /* load offset32 */ \ 62 V(LOAD_4_CURRENT_CHARS_UNCHECKED, 22, 4) /* bc8 offset24 */ \
58 V(CHECK_CHAR, 23, 9) /* check_char uint32 addr32 */ \ 63 V(CHECK_4_CHARS, 23, 12) /* bc8 pad24 uint32 addr32 */ \
59 V(CHECK_NOT_CHAR, 24, 9) /* check_not_char uint32 addr32 */ \ 64 V(CHECK_CHAR, 24, 8) /* bc8 pad8 uint16 addr32 */ \
60 V(AND_CHECK_CHAR, 25, 13) /* and_check_char uint32 uint32 addr32 */ \ 65 V(CHECK_NOT_4_CHARS, 25, 12) /* bc8 pad24 uint32 addr32 */ \
61 V(AND_CHECK_NOT_CHAR, 26, 13) /* and_check_not_char uint32 uint32 addr32 */ \ 66 V(CHECK_NOT_CHAR, 26, 8) /* bc8 pad8 uint16 addr32 */ \
62 V(MINUS_AND_CHECK_NOT_CHAR, 27, 11) /* minus_and_check_not_char uc16 uc16...*/ \ 67 V(AND_CHECK_4_CHARS, 27, 16) /* bc8 pad24 uint32 uint32 addr32 */ \
63 V(CHECK_LT, 28, 7) /* check_lt uc16 addr32 */ \ 68 V(AND_CHECK_CHAR, 28, 12) /* bc8 pad8 uint16 uint32 addr32 */ \
64 V(CHECK_GT, 29, 7) /* check_gr uc16 addr32 */ \ 69 V(AND_CHECK_NOT_4_CHARS, 29, 16) /* bc8 pad24 uint32 uint32 addr32 */ \
65 V(CHECK_NOT_BACK_REF, 30, 6) /* check_not_back_ref capture_idx addr32 */ \ 70 V(AND_CHECK_NOT_CHAR, 30, 12) /* bc8 pad8 uint16 uint32 addr32 */ \
66 V(CHECK_NOT_BACK_REF_NO_CASE, 31, 6) /* check_not_back_ref_no_case captu... */ \ 71 V(MINUS_AND_CHECK_NOT_CHAR, 31, 12) /* bc8 pad8 uc16 uc16 addr32 */ \
67 V(CHECK_NOT_REGS_EQUAL, 32, 7) /* check_not_regs_equal reg1 reg2 addr32 */ \ 72 V(CHECK_LT, 32, 8) /* bc8 pad8 uc16 addr32 */ \
68 V(LOOKUP_MAP1, 33, 11) /* l_map1 start16 bit_map_addr32 addr32 */ \ 73 V(CHECK_GT, 33, 8) /* bc8 pad8 uc16 addr32 */ \
69 V(LOOKUP_MAP2, 34, 99) /* l_map2 start16 half_nibble_map_addr32* */ \ 74 V(CHECK_NOT_BACK_REF, 34, 8) /* bc8 reg_idx24 addr32 */ \
70 V(LOOKUP_MAP8, 35, 99) /* l_map8 start16 byte_map addr32* */ \ 75 V(CHECK_NOT_BACK_REF_NO_CASE, 35, 8) /* bc8 reg_idx24 addr32 */ \
71 V(LOOKUP_HI_MAP8, 36, 99) /* l_himap8 start8 byte_map_addr32 addr32* */ \ 76 V(CHECK_NOT_REGS_EQUAL, 36, 12) /* bc8 regidx24 reg_idx32 addr32 */ \
72 V(CHECK_REGISTER_LT, 37, 8) /* check_reg_lt register_index value16 addr32 */ \ 77 V(LOOKUP_MAP1, 37, 12) /* bc8 pad8 start16 bit_map_addr32 addr32 */ \
73 V(CHECK_REGISTER_GE, 38, 8) /* check_reg_ge register_index value16 addr32 */ \ 78 V(LOOKUP_MAP2, 38, 96) /* bc8 pad8 start16 half_nibble_map_addr32* */ \
74 V(CHECK_REGISTER_EQ_POS, 39, 6) /* check_register_eq_pos index addr32 */ \ 79 V(LOOKUP_MAP8, 39, 96) /* bc8 pad8 start16 byte_map addr32* */ \
75 V(CHECK_AT_START, 40, 5) /* check_at_start addr32 */ \ 80 V(LOOKUP_HI_MAP8, 40, 96) /* bc8 start24 byte_map_addr32 addr32* */ \
76 V(CHECK_NOT_AT_START, 41, 5) /* check_not_at_start addr32 */ \ 81 V(CHECK_REGISTER_LT, 41, 12) /* bc8 reg_idx24 value32 addr32 */ \
77 V(CHECK_GREEDY, 42, 5) /* check_greedy addr32 */ 82 V(CHECK_REGISTER_GE, 42, 12) /* bc8 reg_idx24 value32 addr32 */ \
83 V(CHECK_REGISTER_EQ_POS, 43, 8) /* bc8 reg_idx24 addr32 */ \
84 V(CHECK_AT_START, 44, 8) /* bc8 pad24 addr32 */ \
85 V(CHECK_NOT_AT_START, 45, 8) /* bc8 pad24 addr32 */ \
86 V(CHECK_GREEDY, 46, 8) /* bc8 pad24 addr32 */
78 87
79 #define DECLARE_BYTECODES(name, code, length) \ 88 #define DECLARE_BYTECODES(name, code, length) \
80 static const int BC_##name = code; 89 static const int BC_##name = code;
81 BYTECODE_ITERATOR(DECLARE_BYTECODES) 90 BYTECODE_ITERATOR(DECLARE_BYTECODES)
82 #undef DECLARE_BYTECODES 91 #undef DECLARE_BYTECODES
83 92
84 #define DECLARE_BYTECODE_LENGTH(name, code, length) \ 93 #define DECLARE_BYTECODE_LENGTH(name, code, length) \
85 static const int BC_##name##_LENGTH = length; 94 static const int BC_##name##_LENGTH = length;
86 BYTECODE_ITERATOR(DECLARE_BYTECODE_LENGTH) 95 BYTECODE_ITERATOR(DECLARE_BYTECODE_LENGTH)
87 #undef DECLARE_BYTECODE_LENGTH 96 #undef DECLARE_BYTECODE_LENGTH
88 } } 97 } }
89 98
90 #endif // V8_BYTECODES_IRREGEXP_H_ 99 #endif // V8_BYTECODES_IRREGEXP_H_
OLDNEW
« no previous file with comments | « no previous file | src/interpreter-irregexp.cc » ('j') | src/regexp-macro-assembler-irregexp-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698