OLD | NEW |
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 printf("%c", b); | 110 printf("%c", b); |
111 } else { | 111 } else { |
112 printf("."); | 112 printf("."); |
113 } | 113 } |
114 } | 114 } |
115 printf("\n"); | 115 printf("\n"); |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 | 119 |
120 #define BYTECODE(name) \ | 120 #define BYTECODE(name) \ |
121 case BC_##name: \ | 121 case BC_##name: \ |
122 TraceInterpreter(code_base, \ | 122 TraceInterpreter(code_base, \ |
123 pc, \ | 123 pc, \ |
124 backtrack_sp - backtrack_stack_base, \ | 124 static_cast<int>(backtrack_sp - backtrack_stack_base), \ |
125 current, \ | 125 current, \ |
126 current_char, \ | 126 current_char, \ |
127 BC_##name##_LENGTH, \ | 127 BC_##name##_LENGTH, \ |
128 #name); | 128 #name); |
129 #else | 129 #else |
130 #define BYTECODE(name) \ | 130 #define BYTECODE(name) \ |
131 case BC_##name: | 131 case BC_##name: |
132 #endif | 132 #endif |
133 | 133 |
134 | 134 |
135 static int32_t Load32Aligned(const byte* pc) { | 135 static int32_t Load32Aligned(const byte* pc) { |
136 ASSERT((reinterpret_cast<intptr_t>(pc) & 3) == 0); | 136 ASSERT((reinterpret_cast<intptr_t>(pc) & 3) == 0); |
137 return *reinterpret_cast<const int32_t *>(pc); | 137 return *reinterpret_cast<const int32_t *>(pc); |
138 } | 138 } |
139 | 139 |
140 | 140 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 break; | 243 break; |
244 BYTECODE(SET_REGISTER_TO_CP) | 244 BYTECODE(SET_REGISTER_TO_CP) |
245 registers[insn >> BYTECODE_SHIFT] = current + Load32Aligned(pc + 4); | 245 registers[insn >> BYTECODE_SHIFT] = current + Load32Aligned(pc + 4); |
246 pc += BC_SET_REGISTER_TO_CP_LENGTH; | 246 pc += BC_SET_REGISTER_TO_CP_LENGTH; |
247 break; | 247 break; |
248 BYTECODE(SET_CP_TO_REGISTER) | 248 BYTECODE(SET_CP_TO_REGISTER) |
249 current = registers[insn >> BYTECODE_SHIFT]; | 249 current = registers[insn >> BYTECODE_SHIFT]; |
250 pc += BC_SET_CP_TO_REGISTER_LENGTH; | 250 pc += BC_SET_CP_TO_REGISTER_LENGTH; |
251 break; | 251 break; |
252 BYTECODE(SET_REGISTER_TO_SP) | 252 BYTECODE(SET_REGISTER_TO_SP) |
253 registers[insn >> BYTECODE_SHIFT] = backtrack_sp - backtrack_stack_base; | 253 registers[insn >> BYTECODE_SHIFT] = |
| 254 static_cast<int>(backtrack_sp - backtrack_stack_base); |
254 pc += BC_SET_REGISTER_TO_SP_LENGTH; | 255 pc += BC_SET_REGISTER_TO_SP_LENGTH; |
255 break; | 256 break; |
256 BYTECODE(SET_SP_TO_REGISTER) | 257 BYTECODE(SET_SP_TO_REGISTER) |
257 backtrack_sp = backtrack_stack_base + registers[insn >> BYTECODE_SHIFT]; | 258 backtrack_sp = backtrack_stack_base + registers[insn >> BYTECODE_SHIFT]; |
258 backtrack_stack_space = backtrack_stack.max_size() - | 259 backtrack_stack_space = backtrack_stack.max_size() - |
259 (backtrack_sp - backtrack_stack_base); | 260 static_cast<int>(backtrack_sp - backtrack_stack_base); |
260 pc += BC_SET_SP_TO_REGISTER_LENGTH; | 261 pc += BC_SET_SP_TO_REGISTER_LENGTH; |
261 break; | 262 break; |
262 BYTECODE(POP_CP) | 263 BYTECODE(POP_CP) |
263 backtrack_stack_space++; | 264 backtrack_stack_space++; |
264 --backtrack_sp; | 265 --backtrack_sp; |
265 current = *backtrack_sp; | 266 current = *backtrack_sp; |
266 pc += BC_POP_CP_LENGTH; | 267 pc += BC_POP_CP_LENGTH; |
267 break; | 268 break; |
268 BYTECODE(POP_BT) | 269 BYTECODE(POP_BT) |
269 backtrack_stack_space++; | 270 backtrack_stack_space++; |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 if (start_position != 0) previous_char = subject_vector[start_position - 1]; | 637 if (start_position != 0) previous_char = subject_vector[start_position - 1]; |
637 return RawMatch(code_base, | 638 return RawMatch(code_base, |
638 subject_vector, | 639 subject_vector, |
639 registers, | 640 registers, |
640 start_position, | 641 start_position, |
641 previous_char); | 642 previous_char); |
642 } | 643 } |
643 } | 644 } |
644 | 645 |
645 } } // namespace v8::internal | 646 } } // namespace v8::internal |
OLD | NEW |