| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 mode); | 286 mode); |
| 287 | 287 |
| 288 // Calculate the substring of the first match before creating the result array | 288 // Calculate the substring of the first match before creating the result array |
| 289 // to avoid an unnecessary write barrier storing the first result. | 289 // to avoid an unnecessary write barrier storing the first result. |
| 290 Node* const first = a->SubString(context, string, start, end); | 290 Node* const first = a->SubString(context, string, start, end); |
| 291 | 291 |
| 292 Node* const result = | 292 Node* const result = |
| 293 a->AllocateRegExpResult(context, num_results, start, string); | 293 a->AllocateRegExpResult(context, num_results, start, string); |
| 294 Node* const result_elements = a->LoadElements(result); | 294 Node* const result_elements = a->LoadElements(result); |
| 295 | 295 |
| 296 a->StoreFixedArrayElement(result_elements, 0, first, SKIP_WRITE_BARRIER); | 296 a->StoreFixedArrayElement(result_elements, a->IntPtrConstant(0), first, |
| 297 SKIP_WRITE_BARRIER); |
| 297 | 298 |
| 298 a->GotoIf(a->SmiEqual(num_results, a->SmiConstant(Smi::FromInt(1))), &out); | 299 a->GotoIf(a->SmiEqual(num_results, a->SmiConstant(Smi::FromInt(1))), &out); |
| 299 | 300 |
| 300 // Store all remaining captures. | 301 // Store all remaining captures. |
| 301 Node* const limit = a->IntPtrAdd( | 302 Node* const limit = a->IntPtrAdd( |
| 302 a->IntPtrConstant(RegExpMatchInfo::kFirstCaptureIndex), num_indices); | 303 a->IntPtrConstant(RegExpMatchInfo::kFirstCaptureIndex), num_indices); |
| 303 | 304 |
| 304 Variable var_from_cursor(a, MachineType::PointerRepresentation()); | 305 Variable var_from_cursor(a, MachineType::PointerRepresentation()); |
| 305 Variable var_to_cursor(a, MachineType::PointerRepresentation()); | 306 Variable var_to_cursor(a, MachineType::PointerRepresentation()); |
| 306 | 307 |
| (...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1838 | 1839 |
| 1839 Node* const replacement_obj = | 1840 Node* const replacement_obj = |
| 1840 a->CallJS(call_callable, context, reflect_apply, undefined, | 1841 a->CallJS(call_callable, context, reflect_apply, undefined, |
| 1841 replace_callable, undefined, elem); | 1842 replace_callable, undefined, elem); |
| 1842 | 1843 |
| 1843 // Overwrite the i'th element in the results with the string we got | 1844 // Overwrite the i'th element in the results with the string we got |
| 1844 // back from the callback function. | 1845 // back from the callback function. |
| 1845 | 1846 |
| 1846 Node* const replacement_str = a->ToString(context, replacement_obj); | 1847 Node* const replacement_str = a->ToString(context, replacement_obj); |
| 1847 a->StoreFixedArrayElement(res_elems, index, replacement_str, | 1848 a->StoreFixedArrayElement(res_elems, index, replacement_str, |
| 1848 UPDATE_WRITE_BARRIER, 0, mode); | 1849 UPDATE_WRITE_BARRIER, mode); |
| 1849 | 1850 |
| 1850 a->Goto(&do_continue); | 1851 a->Goto(&do_continue); |
| 1851 a->Bind(&do_continue); | 1852 a->Bind(&do_continue); |
| 1852 }, | 1853 }, |
| 1853 increment, CodeStubAssembler::IndexAdvanceMode::kPost); | 1854 increment, CodeStubAssembler::IndexAdvanceMode::kPost); |
| 1854 | 1855 |
| 1855 a->Goto(&create_result); | 1856 a->Goto(&create_result); |
| 1856 } | 1857 } |
| 1857 | 1858 |
| 1858 a->Bind(&create_result); | 1859 a->Bind(&create_result); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2116 a.Bind(&if_matched); | 2117 a.Bind(&if_matched); |
| 2117 { | 2118 { |
| 2118 Node* result = ConstructNewResultFromMatchInfo(isolate, &a, context, | 2119 Node* result = ConstructNewResultFromMatchInfo(isolate, &a, context, |
| 2119 match_indices, string); | 2120 match_indices, string); |
| 2120 a.Return(result); | 2121 a.Return(result); |
| 2121 } | 2122 } |
| 2122 } | 2123 } |
| 2123 | 2124 |
| 2124 } // namespace internal | 2125 } // namespace internal |
| 2125 } // namespace v8 | 2126 } // namespace v8 |
| OLD | NEW |