OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 VM_REGEXP_H_ | 5 #ifndef VM_REGEXP_H_ |
6 #define VM_REGEXP_H_ | 6 #define VM_REGEXP_H_ |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 | 1370 |
1371 | 1371 |
1372 class RegExpEngine: public AllStatic { | 1372 class RegExpEngine: public AllStatic { |
1373 public: | 1373 public: |
1374 struct CompilationResult { | 1374 struct CompilationResult { |
1375 explicit CompilationResult(const char* error_message) | 1375 explicit CompilationResult(const char* error_message) |
1376 : backtrack_goto(NULL), | 1376 : backtrack_goto(NULL), |
1377 graph_entry(NULL), | 1377 graph_entry(NULL), |
1378 num_blocks(-1), | 1378 num_blocks(-1), |
1379 num_stack_locals(-1), | 1379 num_stack_locals(-1), |
1380 error_message(error_message) {} | 1380 error_message(error_message), |
| 1381 bytecode(NULL), |
| 1382 num_registers(-1) {} |
| 1383 |
| 1384 CompilationResult(TypedData* bytecode, intptr_t num_registers) |
| 1385 : backtrack_goto(NULL), |
| 1386 graph_entry(NULL), |
| 1387 num_blocks(-1), |
| 1388 num_stack_locals(-1), |
| 1389 error_message(NULL), |
| 1390 bytecode(bytecode), |
| 1391 num_registers(num_registers) {} |
| 1392 |
1381 CompilationResult(IndirectGotoInstr* backtrack_goto, | 1393 CompilationResult(IndirectGotoInstr* backtrack_goto, |
1382 GraphEntryInstr* graph_entry, | 1394 GraphEntryInstr* graph_entry, |
1383 intptr_t num_blocks, | 1395 intptr_t num_blocks, |
1384 intptr_t num_stack_locals) | 1396 intptr_t num_stack_locals, |
| 1397 intptr_t num_registers) |
1385 : backtrack_goto(backtrack_goto), | 1398 : backtrack_goto(backtrack_goto), |
1386 graph_entry(graph_entry), | 1399 graph_entry(graph_entry), |
1387 num_blocks(num_blocks), | 1400 num_blocks(num_blocks), |
1388 num_stack_locals(num_stack_locals), | 1401 num_stack_locals(num_stack_locals), |
1389 error_message(NULL) {} | 1402 error_message(NULL), |
| 1403 bytecode(NULL) {} |
1390 | 1404 |
1391 IndirectGotoInstr* backtrack_goto; | 1405 IndirectGotoInstr* backtrack_goto; |
1392 GraphEntryInstr* graph_entry; | 1406 GraphEntryInstr* graph_entry; |
1393 const intptr_t num_blocks; | 1407 const intptr_t num_blocks; |
1394 const intptr_t num_stack_locals; | 1408 const intptr_t num_stack_locals; |
1395 | 1409 |
1396 const char* error_message; | 1410 const char* error_message; |
| 1411 |
| 1412 TypedData* bytecode; |
| 1413 intptr_t num_registers; |
1397 }; | 1414 }; |
1398 | 1415 |
1399 static CompilationResult Compile( | 1416 static CompilationResult CompileIR( |
1400 RegExpCompileData* input, | 1417 RegExpCompileData* input, |
1401 const ParsedFunction* parsed_function, | 1418 const ParsedFunction* parsed_function, |
1402 const ZoneGrowableArray<const ICData*>& ic_data_array); | 1419 const ZoneGrowableArray<const ICData*>& ic_data_array); |
1403 | 1420 |
| 1421 static CompilationResult CompileBytecode( |
| 1422 RegExpCompileData* data, |
| 1423 const JSRegExp& regexp, |
| 1424 bool is_one_byte, |
| 1425 Zone* zone); |
| 1426 |
1404 static RawJSRegExp* CreateJSRegExp( | 1427 static RawJSRegExp* CreateJSRegExp( |
1405 Zone* zone, | 1428 Zone* zone, |
1406 const String& pattern, | 1429 const String& pattern, |
1407 bool multi_line, | 1430 bool multi_line, |
1408 bool ignore_case); | 1431 bool ignore_case); |
1409 | 1432 |
1410 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); | 1433 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); |
1411 }; | 1434 }; |
1412 | 1435 |
1413 } // namespace dart | 1436 } // namespace dart |
1414 | 1437 |
1415 #endif // VM_REGEXP_H_ | 1438 #endif // VM_REGEXP_H_ |
OLD | NEW |