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 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 // If no matches, return the subject string. | 1597 // If no matches, return the subject string. |
1598 var_result.Bind(subject_string); | 1598 var_result.Bind(subject_string); |
1599 a->GotoIf(a->WordEqual(res, null), &out); | 1599 a->GotoIf(a->WordEqual(res, null), &out); |
1600 | 1600 |
1601 // Reload last match info since it might have changed. | 1601 // Reload last match info since it might have changed. |
1602 last_match_info = a->LoadContextElement( | 1602 last_match_info = a->LoadContextElement( |
1603 native_context, Context::REGEXP_LAST_MATCH_INFO_INDEX); | 1603 native_context, Context::REGEXP_LAST_MATCH_INFO_INDEX); |
1604 | 1604 |
1605 Node* const res_length = a->LoadJSArrayLength(res); | 1605 Node* const res_length = a->LoadJSArrayLength(res); |
1606 Node* const res_elems = a->LoadElements(res); | 1606 Node* const res_elems = a->LoadElements(res); |
1607 a->AssertInstanceType(res_elems, FIXED_ARRAY_TYPE); | 1607 a->CSA_ASSERT(a->HasInstanceType(res_elems, FIXED_ARRAY_TYPE)); |
1608 | 1608 |
1609 CodeStubAssembler::ParameterMode mode = CodeStubAssembler::INTPTR_PARAMETERS; | 1609 CodeStubAssembler::ParameterMode mode = CodeStubAssembler::INTPTR_PARAMETERS; |
1610 Node* const num_capture_registers = a->LoadFixedArrayElement( | 1610 Node* const num_capture_registers = a->LoadFixedArrayElement( |
1611 last_match_info, | 1611 last_match_info, |
1612 a->IntPtrConstant(RegExpMatchInfo::kNumberOfCapturesIndex), 0, mode); | 1612 a->IntPtrConstant(RegExpMatchInfo::kNumberOfCapturesIndex), 0, mode); |
1613 | 1613 |
1614 Label if_hasexplicitcaptures(a), if_noexplicitcaptures(a), create_result(a); | 1614 Label if_hasexplicitcaptures(a), if_noexplicitcaptures(a), create_result(a); |
1615 a->Branch(a->SmiEqual(num_capture_registers, a->SmiConstant(Smi::FromInt(2))), | 1615 a->Branch(a->SmiEqual(num_capture_registers, a->SmiConstant(Smi::FromInt(2))), |
1616 &if_noexplicitcaptures, &if_hasexplicitcaptures); | 1616 &if_noexplicitcaptures, &if_hasexplicitcaptures); |
1617 | 1617 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 replace_callable, mode](CodeStubAssembler* a, Node* index) { | 1720 replace_callable, mode](CodeStubAssembler* a, Node* index) { |
1721 Node* const elem = | 1721 Node* const elem = |
1722 a->LoadFixedArrayElement(res_elems, index, 0, mode); | 1722 a->LoadFixedArrayElement(res_elems, index, 0, mode); |
1723 | 1723 |
1724 Label do_continue(a); | 1724 Label do_continue(a); |
1725 a->GotoIf(a->TaggedIsSmi(elem), &do_continue); | 1725 a->GotoIf(a->TaggedIsSmi(elem), &do_continue); |
1726 | 1726 |
1727 // elem must be an Array. | 1727 // elem must be an Array. |
1728 // Use the apply argument as backing for global RegExp properties. | 1728 // Use the apply argument as backing for global RegExp properties. |
1729 | 1729 |
1730 a->AssertInstanceType(elem, JS_ARRAY_TYPE); | 1730 a->CSA_ASSERT(a->HasInstanceType(elem, JS_ARRAY_TYPE)); |
1731 | 1731 |
1732 // TODO(jgruber): Remove indirection through Call->ReflectApply. | 1732 // TODO(jgruber): Remove indirection through Call->ReflectApply. |
1733 Callable call_callable = CodeFactory::Call(isolate); | 1733 Callable call_callable = CodeFactory::Call(isolate); |
1734 Node* const reflect_apply = a->LoadContextElement( | 1734 Node* const reflect_apply = a->LoadContextElement( |
1735 native_context, Context::REFLECT_APPLY_INDEX); | 1735 native_context, Context::REFLECT_APPLY_INDEX); |
1736 | 1736 |
1737 Node* const replacement_obj = | 1737 Node* const replacement_obj = |
1738 a->CallJS(call_callable, context, reflect_apply, undefined, | 1738 a->CallJS(call_callable, context, reflect_apply, undefined, |
1739 replace_callable, undefined, elem); | 1739 replace_callable, undefined, elem); |
1740 | 1740 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 a->Bind(&if_matched); | 2010 a->Bind(&if_matched); |
2011 { | 2011 { |
2012 Node* result = ConstructNewResultFromMatchInfo(isolate, a, context, | 2012 Node* result = ConstructNewResultFromMatchInfo(isolate, a, context, |
2013 match_indices, string); | 2013 match_indices, string); |
2014 a->Return(result); | 2014 a->Return(result); |
2015 } | 2015 } |
2016 } | 2016 } |
2017 | 2017 |
2018 } // namespace internal | 2018 } // namespace internal |
2019 } // namespace v8 | 2019 } // namespace v8 |
OLD | NEW |