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 RUNTIME_VM_REGEXP_H_ | 5 #ifndef RUNTIME_VM_REGEXP_H_ |
6 #define RUNTIME_VM_REGEXP_H_ | 6 #define RUNTIME_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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 bool contains_anchor; | 1343 bool contains_anchor; |
1344 String& error; | 1344 String& error; |
1345 intptr_t capture_count; | 1345 intptr_t capture_count; |
1346 }; | 1346 }; |
1347 | 1347 |
1348 | 1348 |
1349 class RegExpEngine : public AllStatic { | 1349 class RegExpEngine : public AllStatic { |
1350 public: | 1350 public: |
1351 struct CompilationResult { | 1351 struct CompilationResult { |
1352 explicit CompilationResult(const char* error_message) | 1352 explicit CompilationResult(const char* error_message) |
1353 : backtrack_goto(NULL), | 1353 : error_message(error_message), |
| 1354 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 1355 backtrack_goto(NULL), |
1354 graph_entry(NULL), | 1356 graph_entry(NULL), |
1355 num_blocks(-1), | 1357 num_blocks(-1), |
1356 num_stack_locals(-1), | 1358 num_stack_locals(-1), |
1357 error_message(error_message), | 1359 #endif |
1358 bytecode(NULL), | 1360 bytecode(NULL), |
1359 num_registers(-1) {} | 1361 num_registers(-1) { |
| 1362 } |
1360 | 1363 |
1361 CompilationResult(TypedData* bytecode, intptr_t num_registers) | 1364 CompilationResult(TypedData* bytecode, intptr_t num_registers) |
1362 : backtrack_goto(NULL), | 1365 : error_message(NULL), |
| 1366 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 1367 backtrack_goto(NULL), |
1363 graph_entry(NULL), | 1368 graph_entry(NULL), |
1364 num_blocks(-1), | 1369 num_blocks(-1), |
1365 num_stack_locals(-1), | 1370 num_stack_locals(-1), |
1366 error_message(NULL), | 1371 #endif |
1367 bytecode(bytecode), | 1372 bytecode(bytecode), |
1368 num_registers(num_registers) {} | 1373 num_registers(num_registers) { |
| 1374 } |
1369 | 1375 |
| 1376 #if !defined(DART_PRECOMPILED_RUNTIME) |
1370 CompilationResult(IndirectGotoInstr* backtrack_goto, | 1377 CompilationResult(IndirectGotoInstr* backtrack_goto, |
1371 GraphEntryInstr* graph_entry, | 1378 GraphEntryInstr* graph_entry, |
1372 intptr_t num_blocks, | 1379 intptr_t num_blocks, |
1373 intptr_t num_stack_locals, | 1380 intptr_t num_stack_locals, |
1374 intptr_t num_registers) | 1381 intptr_t num_registers) |
1375 : backtrack_goto(backtrack_goto), | 1382 : error_message(NULL), |
| 1383 backtrack_goto(backtrack_goto), |
1376 graph_entry(graph_entry), | 1384 graph_entry(graph_entry), |
1377 num_blocks(num_blocks), | 1385 num_blocks(num_blocks), |
1378 num_stack_locals(num_stack_locals), | 1386 num_stack_locals(num_stack_locals), |
1379 error_message(NULL), | |
1380 bytecode(NULL) {} | 1387 bytecode(NULL) {} |
1381 | 1388 #endif |
1382 IndirectGotoInstr* backtrack_goto; | |
1383 GraphEntryInstr* graph_entry; | |
1384 const intptr_t num_blocks; | |
1385 const intptr_t num_stack_locals; | |
1386 | 1389 |
1387 const char* error_message; | 1390 const char* error_message; |
1388 | 1391 |
| 1392 NOT_IN_PRECOMPILED(IndirectGotoInstr* backtrack_goto); |
| 1393 NOT_IN_PRECOMPILED(GraphEntryInstr* graph_entry); |
| 1394 NOT_IN_PRECOMPILED(const intptr_t num_blocks); |
| 1395 NOT_IN_PRECOMPILED(const intptr_t num_stack_locals); |
| 1396 |
1389 TypedData* bytecode; | 1397 TypedData* bytecode; |
1390 intptr_t num_registers; | 1398 intptr_t num_registers; |
1391 }; | 1399 }; |
1392 | 1400 |
| 1401 #if !defined(DART_PRECOMPILED_RUNTIME) |
1393 static CompilationResult CompileIR( | 1402 static CompilationResult CompileIR( |
1394 RegExpCompileData* input, | 1403 RegExpCompileData* input, |
1395 const ParsedFunction* parsed_function, | 1404 const ParsedFunction* parsed_function, |
1396 const ZoneGrowableArray<const ICData*>& ic_data_array, | 1405 const ZoneGrowableArray<const ICData*>& ic_data_array, |
1397 intptr_t osr_id); | 1406 intptr_t osr_id); |
| 1407 #endif |
1398 | 1408 |
1399 static CompilationResult CompileBytecode(RegExpCompileData* data, | 1409 static CompilationResult CompileBytecode(RegExpCompileData* data, |
1400 const RegExp& regexp, | 1410 const RegExp& regexp, |
1401 bool is_one_byte, | 1411 bool is_one_byte, |
1402 bool sticky, | 1412 bool sticky, |
1403 Zone* zone); | 1413 Zone* zone); |
1404 | 1414 |
1405 static RawRegExp* CreateRegExp(Thread* thread, | 1415 static RawRegExp* CreateRegExp(Thread* thread, |
1406 const String& pattern, | 1416 const String& pattern, |
1407 bool multi_line, | 1417 bool multi_line, |
1408 bool ignore_case); | 1418 bool ignore_case); |
1409 | 1419 |
1410 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); | 1420 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); |
1411 }; | 1421 }; |
1412 | 1422 |
1413 } // namespace dart | 1423 } // namespace dart |
1414 | 1424 |
1415 #endif // RUNTIME_VM_REGEXP_H_ | 1425 #endif // RUNTIME_VM_REGEXP_H_ |
OLD | NEW |