Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: src/builtins/builtins-regexp.cc

Issue 2489743002: [stubs] Ensure CSA_ASSERT and CSA_SLOW_ASSERT do not produce unused instructions in release mode. (Closed)
Patch Set: ((void)0) Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/builtins/builtins-array.cc ('k') | src/builtins/builtins-string.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 // If no matches, return the subject string. 1595 // If no matches, return the subject string.
1596 var_result.Bind(subject_string); 1596 var_result.Bind(subject_string);
1597 a->GotoIf(a->WordEqual(res, null), &out); 1597 a->GotoIf(a->WordEqual(res, null), &out);
1598 1598
1599 // Reload last match info since it might have changed. 1599 // Reload last match info since it might have changed.
1600 last_match_info = a->LoadContextElement( 1600 last_match_info = a->LoadContextElement(
1601 native_context, Context::REGEXP_LAST_MATCH_INFO_INDEX); 1601 native_context, Context::REGEXP_LAST_MATCH_INFO_INDEX);
1602 1602
1603 Node* const res_length = a->LoadJSArrayLength(res); 1603 Node* const res_length = a->LoadJSArrayLength(res);
1604 Node* const res_elems = a->LoadElements(res); 1604 Node* const res_elems = a->LoadElements(res);
1605 a->CSA_ASSERT(a->HasInstanceType(res_elems, FIXED_ARRAY_TYPE)); 1605 CSA_ASSERT(a, a->HasInstanceType(res_elems, FIXED_ARRAY_TYPE));
1606 1606
1607 CodeStubAssembler::ParameterMode mode = CodeStubAssembler::INTPTR_PARAMETERS; 1607 CodeStubAssembler::ParameterMode mode = CodeStubAssembler::INTPTR_PARAMETERS;
1608 Node* const num_capture_registers = a->LoadFixedArrayElement( 1608 Node* const num_capture_registers = a->LoadFixedArrayElement(
1609 last_match_info, 1609 last_match_info,
1610 a->IntPtrConstant(RegExpMatchInfo::kNumberOfCapturesIndex), 0, mode); 1610 a->IntPtrConstant(RegExpMatchInfo::kNumberOfCapturesIndex), 0, mode);
1611 1611
1612 Label if_hasexplicitcaptures(a), if_noexplicitcaptures(a), create_result(a); 1612 Label if_hasexplicitcaptures(a), if_noexplicitcaptures(a), create_result(a);
1613 a->Branch(a->SmiEqual(num_capture_registers, a->SmiConstant(Smi::FromInt(2))), 1613 a->Branch(a->SmiEqual(num_capture_registers, a->SmiConstant(Smi::FromInt(2))),
1614 &if_noexplicitcaptures, &if_hasexplicitcaptures); 1614 &if_noexplicitcaptures, &if_hasexplicitcaptures);
1615 1615
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 a->LoadFixedArrayElement(res_elems, next_i, 0, mode); 1670 a->LoadFixedArrayElement(res_elems, next_i, 0, mode);
1671 1671
1672 Node* const new_match_start = a->SmiSub(next_elem, elem); 1672 Node* const new_match_start = a->SmiSub(next_elem, elem);
1673 var_match_start.Bind(new_match_start); 1673 var_match_start.Bind(new_match_start);
1674 a->Goto(&loop_epilogue); 1674 a->Goto(&loop_epilogue);
1675 } 1675 }
1676 } 1676 }
1677 1677
1678 a->Bind(&if_isstring); 1678 a->Bind(&if_isstring);
1679 { 1679 {
1680 a->Assert(a->IsStringInstanceType(a->LoadInstanceType(elem))); 1680 CSA_ASSERT(a, a->IsStringInstanceType(a->LoadInstanceType(elem)));
1681 1681
1682 Callable call_callable = CodeFactory::Call(isolate); 1682 Callable call_callable = CodeFactory::Call(isolate);
1683 Node* const replacement_obj = 1683 Node* const replacement_obj =
1684 a->CallJS(call_callable, context, replace_callable, undefined, elem, 1684 a->CallJS(call_callable, context, replace_callable, undefined, elem,
1685 var_match_start.value(), subject_string); 1685 var_match_start.value(), subject_string);
1686 1686
1687 Node* const replacement_str = a->ToString(context, replacement_obj); 1687 Node* const replacement_str = a->ToString(context, replacement_obj);
1688 a->StoreFixedArrayElement(res_elems, i, replacement_str); 1688 a->StoreFixedArrayElement(res_elems, i, replacement_str);
1689 1689
1690 Node* const elem_length = a->LoadStringLength(elem); 1690 Node* const elem_length = a->LoadStringLength(elem);
(...skipping 27 matching lines...) Expand all
1718 replace_callable, mode](CodeStubAssembler* a, Node* index) { 1718 replace_callable, mode](CodeStubAssembler* a, Node* index) {
1719 Node* const elem = 1719 Node* const elem =
1720 a->LoadFixedArrayElement(res_elems, index, 0, mode); 1720 a->LoadFixedArrayElement(res_elems, index, 0, mode);
1721 1721
1722 Label do_continue(a); 1722 Label do_continue(a);
1723 a->GotoIf(a->TaggedIsSmi(elem), &do_continue); 1723 a->GotoIf(a->TaggedIsSmi(elem), &do_continue);
1724 1724
1725 // elem must be an Array. 1725 // elem must be an Array.
1726 // Use the apply argument as backing for global RegExp properties. 1726 // Use the apply argument as backing for global RegExp properties.
1727 1727
1728 a->CSA_ASSERT(a->HasInstanceType(elem, JS_ARRAY_TYPE)); 1728 CSA_ASSERT(a, a->HasInstanceType(elem, JS_ARRAY_TYPE));
1729 1729
1730 // TODO(jgruber): Remove indirection through Call->ReflectApply. 1730 // TODO(jgruber): Remove indirection through Call->ReflectApply.
1731 Callable call_callable = CodeFactory::Call(isolate); 1731 Callable call_callable = CodeFactory::Call(isolate);
1732 Node* const reflect_apply = a->LoadContextElement( 1732 Node* const reflect_apply = a->LoadContextElement(
1733 native_context, Context::REFLECT_APPLY_INDEX); 1733 native_context, Context::REFLECT_APPLY_INDEX);
1734 1734
1735 Node* const replacement_obj = 1735 Node* const replacement_obj =
1736 a->CallJS(call_callable, context, reflect_apply, undefined, 1736 a->CallJS(call_callable, context, reflect_apply, undefined,
1737 replace_callable, undefined, elem); 1737 replace_callable, undefined, elem);
1738 1738
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 a->Bind(&if_matched); 2008 a->Bind(&if_matched);
2009 { 2009 {
2010 Node* result = ConstructNewResultFromMatchInfo(isolate, a, context, 2010 Node* result = ConstructNewResultFromMatchInfo(isolate, a, context,
2011 match_indices, string); 2011 match_indices, string);
2012 a->Return(result); 2012 a->Return(result);
2013 } 2013 }
2014 } 2014 }
2015 2015
2016 } // namespace internal 2016 } // namespace internal
2017 } // namespace v8 2017 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-array.cc ('k') | src/builtins/builtins-string.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698