| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 // /foo(bar|ip)baz/ the code to match baz will be generated twice, once as part | 1323 // /foo(bar|ip)baz/ the code to match baz will be generated twice, once as part |
| 1324 // of the foo-bar-baz trace and once as part of the foo-ip-baz trace. The code | 1324 // of the foo-bar-baz trace and once as part of the foo-ip-baz trace. The code |
| 1325 // to match foo is generated only once (the traces have a common prefix). The | 1325 // to match foo is generated only once (the traces have a common prefix). The |
| 1326 // code to store the capture is deferred and generated (twice) after the places | 1326 // code to store the capture is deferred and generated (twice) after the places |
| 1327 // where baz has been matched. | 1327 // where baz has been matched. |
| 1328 class Trace { | 1328 class Trace { |
| 1329 public: | 1329 public: |
| 1330 // A value for a property that is either known to be true, know to be false, | 1330 // A value for a property that is either known to be true, know to be false, |
| 1331 // or not known. | 1331 // or not known. |
| 1332 enum TriBool { | 1332 enum TriBool { |
| 1333 UNKNOWN = -1, FALSE = 0, TRUE = 1 | 1333 UNKNOWN = -1, FALSE_LITERAL = 0, TRUE_LITERAL = 1 |
| 1334 }; | 1334 }; |
| 1335 | 1335 |
| 1336 class DeferredAction { | 1336 class DeferredAction { |
| 1337 public: | 1337 public: |
| 1338 DeferredAction(ActionNode::ActionType action_type, int reg) | 1338 DeferredAction(ActionNode::ActionType action_type, int reg) |
| 1339 : action_type_(action_type), reg_(reg), next_(NULL) { } | 1339 : action_type_(action_type), reg_(reg), next_(NULL) { } |
| 1340 DeferredAction* next() { return next_; } | 1340 DeferredAction* next() { return next_; } |
| 1341 bool Mentions(int reg); | 1341 bool Mentions(int reg); |
| 1342 int reg() { return reg_; } | 1342 int reg() { return reg_; } |
| 1343 ActionNode::ActionType action_type() { return action_type_; } | 1343 ActionNode::ActionType action_type() { return action_type_; } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 bool is_trivial() { | 1419 bool is_trivial() { |
| 1420 return backtrack_ == NULL && | 1420 return backtrack_ == NULL && |
| 1421 actions_ == NULL && | 1421 actions_ == NULL && |
| 1422 cp_offset_ == 0 && | 1422 cp_offset_ == 0 && |
| 1423 characters_preloaded_ == 0 && | 1423 characters_preloaded_ == 0 && |
| 1424 bound_checked_up_to_ == 0 && | 1424 bound_checked_up_to_ == 0 && |
| 1425 quick_check_performed_.characters() == 0 && | 1425 quick_check_performed_.characters() == 0 && |
| 1426 at_start_ == UNKNOWN; | 1426 at_start_ == UNKNOWN; |
| 1427 } | 1427 } |
| 1428 TriBool at_start() { return at_start_; } | 1428 TriBool at_start() { return at_start_; } |
| 1429 void set_at_start(bool at_start) { at_start_ = at_start ? TRUE : FALSE; } | 1429 void set_at_start(bool at_start) { |
| 1430 at_start_ = at_start ? TRUE_LITERAL : FALSE_LITERAL; |
| 1431 } |
| 1430 Label* backtrack() { return backtrack_; } | 1432 Label* backtrack() { return backtrack_; } |
| 1431 Label* loop_label() { return loop_label_; } | 1433 Label* loop_label() { return loop_label_; } |
| 1432 RegExpNode* stop_node() { return stop_node_; } | 1434 RegExpNode* stop_node() { return stop_node_; } |
| 1433 int characters_preloaded() { return characters_preloaded_; } | 1435 int characters_preloaded() { return characters_preloaded_; } |
| 1434 int bound_checked_up_to() { return bound_checked_up_to_; } | 1436 int bound_checked_up_to() { return bound_checked_up_to_; } |
| 1435 int flush_budget() { return flush_budget_; } | 1437 int flush_budget() { return flush_budget_; } |
| 1436 QuickCheckDetails* quick_check_performed() { return &quick_check_performed_; } | 1438 QuickCheckDetails* quick_check_performed() { return &quick_check_performed_; } |
| 1437 bool mentions_reg(int reg); | 1439 bool mentions_reg(int reg); |
| 1438 // Returns true if a deferred position store exists to the specified | 1440 // Returns true if a deferred position store exists to the specified |
| 1439 // register and stores the offset in the out-parameter. Otherwise | 1441 // register and stores the offset in the out-parameter. Otherwise |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1613 Handle<String> sample_subject, | 1615 Handle<String> sample_subject, |
| 1614 bool is_ascii, Zone* zone); | 1616 bool is_ascii, Zone* zone); |
| 1615 | 1617 |
| 1616 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); | 1618 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); |
| 1617 }; | 1619 }; |
| 1618 | 1620 |
| 1619 | 1621 |
| 1620 } } // namespace v8::internal | 1622 } } // namespace v8::internal |
| 1621 | 1623 |
| 1622 #endif // V8_JSREGEXP_H_ | 1624 #endif // V8_JSREGEXP_H_ |
| OLD | NEW |