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