| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/builtins/builtins-regexp.h" | 5 #include "src/builtins/builtins-regexp.h" |
| 6 | 6 |
| 7 #include "src/builtins/builtins-constructor.h" | 7 #include "src/builtins/builtins-constructor.h" |
| 8 #include "src/builtins/builtins-utils.h" | 8 #include "src/builtins/builtins-utils.h" |
| 9 #include "src/builtins/builtins.h" | 9 #include "src/builtins/builtins.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1716 Isolate* const isolate = this->isolate(); | 1716 Isolate* const isolate = this->isolate(); |
| 1717 | 1717 |
| 1718 Node* const smi_zero = SmiConstant(Smi::kZero); | 1718 Node* const smi_zero = SmiConstant(Smi::kZero); |
| 1719 | 1719 |
| 1720 // Grab the initial value of last index. | 1720 // Grab the initial value of last index. |
| 1721 Node* const previous_last_index = SlowLoadLastIndex(context, regexp); | 1721 Node* const previous_last_index = SlowLoadLastIndex(context, regexp); |
| 1722 | 1722 |
| 1723 // Ensure last index is 0. | 1723 // Ensure last index is 0. |
| 1724 { | 1724 { |
| 1725 Label next(this); | 1725 Label next(this); |
| 1726 GotoIf(SameValue(previous_last_index, smi_zero, context), &next); | 1726 GotoIf(SameValue(previous_last_index, smi_zero), &next); |
| 1727 | 1727 |
| 1728 SlowStoreLastIndex(context, regexp, smi_zero); | 1728 SlowStoreLastIndex(context, regexp, smi_zero); |
| 1729 Goto(&next); | 1729 Goto(&next); |
| 1730 Bind(&next); | 1730 Bind(&next); |
| 1731 } | 1731 } |
| 1732 | 1732 |
| 1733 // Call exec. | 1733 // Call exec. |
| 1734 Node* const exec_result = RegExpExec(context, regexp, string); | 1734 Node* const exec_result = RegExpExec(context, regexp, string); |
| 1735 | 1735 |
| 1736 // Reset last index if necessary. | 1736 // Reset last index if necessary. |
| 1737 { | 1737 { |
| 1738 Label next(this); | 1738 Label next(this); |
| 1739 Node* const current_last_index = SlowLoadLastIndex(context, regexp); | 1739 Node* const current_last_index = SlowLoadLastIndex(context, regexp); |
| 1740 | 1740 |
| 1741 GotoIf(SameValue(current_last_index, previous_last_index, context), &next); | 1741 GotoIf(SameValue(current_last_index, previous_last_index), &next); |
| 1742 | 1742 |
| 1743 SlowStoreLastIndex(context, regexp, previous_last_index); | 1743 SlowStoreLastIndex(context, regexp, previous_last_index); |
| 1744 Goto(&next); | 1744 Goto(&next); |
| 1745 | 1745 |
| 1746 Bind(&next); | 1746 Bind(&next); |
| 1747 } | 1747 } |
| 1748 | 1748 |
| 1749 // Return -1 if no match was found. | 1749 // Return -1 if no match was found. |
| 1750 { | 1750 { |
| 1751 Label next(this); | 1751 Label next(this); |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2568 Bind(&if_matched); | 2568 Bind(&if_matched); |
| 2569 { | 2569 { |
| 2570 Node* result = | 2570 Node* result = |
| 2571 ConstructNewResultFromMatchInfo(context, regexp, match_indices, string); | 2571 ConstructNewResultFromMatchInfo(context, regexp, match_indices, string); |
| 2572 Return(result); | 2572 Return(result); |
| 2573 } | 2573 } |
| 2574 } | 2574 } |
| 2575 | 2575 |
| 2576 } // namespace internal | 2576 } // namespace internal |
| 2577 } // namespace v8 | 2577 } // namespace v8 |
| OLD | NEW |