OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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-regexp-gen.h" | 5 #include "src/builtins/builtins-regexp-gen.h" |
6 | 6 |
7 #include "src/builtins/builtins-constructor.h" | 7 #include "src/builtins/builtins-constructor.h" |
8 #include "src/builtins/builtins-utils-gen.h" | 8 #include "src/builtins/builtins-utils-gen.h" |
9 #include "src/builtins/builtins.h" | 9 #include "src/builtins/builtins.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2147 Node* const length = smi_zero; | 2147 Node* const length = smi_zero; |
2148 Node* const capacity = int_zero; | 2148 Node* const capacity = int_zero; |
2149 Node* const result = AllocateJSArray(kind, array_map, capacity, length, | 2149 Node* const result = AllocateJSArray(kind, array_map, capacity, length, |
2150 allocation_site, mode); | 2150 allocation_site, mode); |
2151 Return(result); | 2151 Return(result); |
2152 } | 2152 } |
2153 } | 2153 } |
2154 | 2154 |
2155 // Helper that skips a few initial checks. | 2155 // Helper that skips a few initial checks. |
2156 TF_BUILTIN(RegExpSplit, RegExpBuiltinsAssembler) { | 2156 TF_BUILTIN(RegExpSplit, RegExpBuiltinsAssembler) { |
2157 typedef RegExpSplitDescriptor Descriptor; | 2157 typedef GenericTagged3Descriptor Descriptor; |
2158 | 2158 |
2159 Node* const regexp = Parameter(Descriptor::kReceiver); | 2159 Node* const regexp = Parameter(Descriptor::kFirst); |
2160 Node* const string = Parameter(Descriptor::kString); | 2160 Node* const string = Parameter(Descriptor::kSecond); |
2161 Node* const maybe_limit = Parameter(Descriptor::kLimit); | 2161 Node* const maybe_limit = Parameter(Descriptor::kThird); |
2162 Node* const context = Parameter(Descriptor::kContext); | 2162 Node* const context = Parameter(Descriptor::kContext); |
2163 | 2163 |
2164 CSA_ASSERT(this, IsFastRegExpMap(context, LoadMap(regexp))); | 2164 CSA_ASSERT(this, IsFastRegExpMap(context, LoadMap(regexp))); |
2165 CSA_ASSERT(this, IsString(string)); | 2165 CSA_ASSERT(this, IsString(string)); |
2166 | 2166 |
2167 // TODO(jgruber): Even if map checks send us to the fast path, we still need | 2167 // TODO(jgruber): Even if map checks send us to the fast path, we still need |
2168 // to verify the constructor property and jump to the slow path if it has | 2168 // to verify the constructor property and jump to the slow path if it has |
2169 // been changed. | 2169 // been changed. |
2170 | 2170 |
2171 // Convert {maybe_limit} to a uint32, capping at the maximal smi value. | 2171 // Convert {maybe_limit} to a uint32, capping at the maximal smi value. |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2529 Goto(&out); | 2529 Goto(&out); |
2530 } | 2530 } |
2531 } | 2531 } |
2532 | 2532 |
2533 Bind(&out); | 2533 Bind(&out); |
2534 return var_result.value(); | 2534 return var_result.value(); |
2535 } | 2535 } |
2536 | 2536 |
2537 // Helper that skips a few initial checks. | 2537 // Helper that skips a few initial checks. |
2538 TF_BUILTIN(RegExpReplace, RegExpBuiltinsAssembler) { | 2538 TF_BUILTIN(RegExpReplace, RegExpBuiltinsAssembler) { |
2539 typedef RegExpReplaceDescriptor Descriptor; | 2539 typedef GenericTagged3Descriptor Descriptor; |
2540 | 2540 |
2541 Node* const regexp = Parameter(Descriptor::kReceiver); | 2541 Node* const regexp = Parameter(Descriptor::kFirst); |
2542 Node* const string = Parameter(Descriptor::kString); | 2542 Node* const string = Parameter(Descriptor::kSecond); |
2543 Node* const replace_value = Parameter(Descriptor::kReplaceValue); | 2543 Node* const replace_value = Parameter(Descriptor::kThird); |
2544 Node* const context = Parameter(Descriptor::kContext); | 2544 Node* const context = Parameter(Descriptor::kContext); |
2545 | 2545 |
2546 CSA_ASSERT(this, IsFastRegExpMap(context, LoadMap(regexp))); | 2546 CSA_ASSERT(this, IsFastRegExpMap(context, LoadMap(regexp))); |
2547 CSA_ASSERT(this, IsString(string)); | 2547 CSA_ASSERT(this, IsString(string)); |
2548 | 2548 |
2549 Label checkreplacestring(this), if_iscallable(this), | 2549 Label checkreplacestring(this), if_iscallable(this), |
2550 runtime(this, Label::kDeferred); | 2550 runtime(this, Label::kDeferred); |
2551 | 2551 |
2552 // 2. Is {replace_value} callable? | 2552 // 2. Is {replace_value} callable? |
2553 GotoIf(TaggedIsSmi(replace_value), &checkreplacestring); | 2553 GotoIf(TaggedIsSmi(replace_value), &checkreplacestring); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2669 Bind(&if_matched); | 2669 Bind(&if_matched); |
2670 { | 2670 { |
2671 Node* result = | 2671 Node* result = |
2672 ConstructNewResultFromMatchInfo(context, regexp, match_indices, string); | 2672 ConstructNewResultFromMatchInfo(context, regexp, match_indices, string); |
2673 Return(result); | 2673 Return(result); |
2674 } | 2674 } |
2675 } | 2675 } |
2676 | 2676 |
2677 } // namespace internal | 2677 } // namespace internal |
2678 } // namespace v8 | 2678 } // namespace v8 |
OLD | NEW |