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-utils.h" | 5 #include "src/builtins/builtins-utils.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
7 | 7 |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/regexp/jsregexp.h" | 9 #include "src/regexp/jsregexp.h" |
10 #include "src/regexp/regexp-utils.h" | 10 #include "src/regexp/regexp-utils.h" |
(...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 a->Bind(&if_replaceisempty); | 1523 a->Bind(&if_replaceisempty); |
1524 { | 1524 { |
1525 // TODO(jgruber): We could skip many of the checks that using SubString | 1525 // TODO(jgruber): We could skip many of the checks that using SubString |
1526 // here entails. | 1526 // here entails. |
1527 | 1527 |
1528 Node* const first_part = | 1528 Node* const first_part = |
1529 a->SubString(context, subject_string, subject_start, match_start); | 1529 a->SubString(context, subject_string, subject_start, match_start); |
1530 Node* const second_part = | 1530 Node* const second_part = |
1531 a->SubString(context, subject_string, match_end, subject_end); | 1531 a->SubString(context, subject_string, match_end, subject_end); |
1532 | 1532 |
1533 Node* const result = a->StringConcat(context, first_part, second_part); | 1533 Node* const result = a->StringAdd(context, first_part, second_part); |
1534 var_result.Bind(result); | 1534 var_result.Bind(result); |
1535 a->Goto(&out); | 1535 a->Goto(&out); |
1536 } | 1536 } |
1537 | 1537 |
1538 a->Bind(&if_replaceisnotempty); | 1538 a->Bind(&if_replaceisnotempty); |
1539 { | 1539 { |
1540 Node* const first_part = | 1540 Node* const first_part = |
1541 a->SubString(context, subject_string, subject_start, match_start); | 1541 a->SubString(context, subject_string, subject_start, match_start); |
1542 Node* const second_part = replace_string; | 1542 Node* const second_part = replace_string; |
1543 Node* const third_part = | 1543 Node* const third_part = |
1544 a->SubString(context, subject_string, match_end, subject_end); | 1544 a->SubString(context, subject_string, match_end, subject_end); |
1545 | 1545 |
1546 Node* result = a->StringConcat(context, first_part, second_part); | 1546 Node* result = a->StringAdd(context, first_part, second_part); |
1547 result = a->StringConcat(context, result, third_part); | 1547 result = a->StringAdd(context, result, third_part); |
1548 | 1548 |
1549 var_result.Bind(result); | 1549 var_result.Bind(result); |
1550 a->Goto(&out); | 1550 a->Goto(&out); |
1551 } | 1551 } |
1552 } | 1552 } |
1553 } | 1553 } |
1554 | 1554 |
1555 a->Bind(&out); | 1555 a->Bind(&out); |
1556 return var_result.value(); | 1556 return var_result.value(); |
1557 } | 1557 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 a->Bind(&if_matched); | 1658 a->Bind(&if_matched); |
1659 { | 1659 { |
1660 Node* result = ConstructNewResultFromMatchInfo(isolate, a, context, | 1660 Node* result = ConstructNewResultFromMatchInfo(isolate, a, context, |
1661 match_indices, string); | 1661 match_indices, string); |
1662 a->Return(result); | 1662 a->Return(result); |
1663 } | 1663 } |
1664 } | 1664 } |
1665 | 1665 |
1666 } // namespace internal | 1666 } // namespace internal |
1667 } // namespace v8 | 1667 } // namespace v8 |
OLD | NEW |