Chromium Code Reviews| 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 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 907 Node* const receiver_map = a->LoadMap(receiver); | 907 Node* const receiver_map = a->LoadMap(receiver); |
| 908 Node* const instance_type = a->LoadMapInstanceType(receiver_map); | 908 Node* const instance_type = a->LoadMapInstanceType(receiver_map); |
| 909 | 909 |
| 910 a->Branch(a->Word32Equal(instance_type, a->Int32Constant(JS_REGEXP_TYPE)), | 910 a->Branch(a->Word32Equal(instance_type, a->Int32Constant(JS_REGEXP_TYPE)), |
| 911 &if_isunmodifiedjsregexp, &if_isnotunmodifiedjsregexp); | 911 &if_isunmodifiedjsregexp, &if_isnotunmodifiedjsregexp); |
| 912 | 912 |
| 913 a->Bind(&if_isunmodifiedjsregexp); | 913 a->Bind(&if_isunmodifiedjsregexp); |
| 914 { | 914 { |
| 915 // Refer to JSRegExp's flag property on the fast-path. | 915 // Refer to JSRegExp's flag property on the fast-path. |
| 916 Node* const is_flag_set = FastFlagGetter(a, receiver, flag); | 916 Node* const is_flag_set = FastFlagGetter(a, receiver, flag); |
| 917 a->Return(a->Select(is_flag_set, a->TrueConstant(), a->FalseConstant())); | 917 a->Return(a->SelectBooleanConstant(is_flag_set)); |
| 918 } | 918 } |
| 919 | 919 |
| 920 a->Bind(&if_isnotunmodifiedjsregexp); | 920 a->Bind(&if_isnotunmodifiedjsregexp); |
| 921 { | 921 { |
| 922 Node* const native_context = a->LoadNativeContext(context); | 922 Node* const native_context = a->LoadNativeContext(context); |
| 923 Node* const regexp_fun = | 923 Node* const regexp_fun = |
| 924 a->LoadContextElement(native_context, Context::REGEXP_FUNCTION_INDEX); | 924 a->LoadContextElement(native_context, Context::REGEXP_FUNCTION_INDEX); |
| 925 Node* const initial_map = a->LoadObjectField( | 925 Node* const initial_map = a->LoadObjectField( |
| 926 regexp_fun, JSFunction::kPrototypeOrInitialMapOffset); | 926 regexp_fun, JSFunction::kPrototypeOrInitialMapOffset); |
| 927 Node* const initial_prototype = a->LoadMapPrototype(initial_map); | 927 Node* const initial_prototype = a->LoadMapPrototype(initial_map); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1185 a.Bind(&if_didnotmatch); | 1185 a.Bind(&if_didnotmatch); |
| 1186 a.Return(a.FalseConstant()); | 1186 a.Return(a.FalseConstant()); |
| 1187 } | 1187 } |
| 1188 | 1188 |
| 1189 a.Bind(&slow_path); | 1189 a.Bind(&slow_path); |
| 1190 { | 1190 { |
| 1191 // Call exec. | 1191 // Call exec. |
| 1192 Node* const match_indices = RegExpExec(&a, context, receiver, string); | 1192 Node* const match_indices = RegExpExec(&a, context, receiver, string); |
| 1193 | 1193 |
| 1194 // Return true iff exec matched successfully. | 1194 // Return true iff exec matched successfully. |
| 1195 Node* const result = a.Select(a.WordEqual(match_indices, a.NullConstant()), | 1195 Node* const result = a.SelectBooleanConstant( |
| 1196 a.FalseConstant(), a.TrueConstant()); | 1196 a.WordNotEqual(match_indices, a.NullConstant())); |
|
Igor Sheludko
2016/12/05 08:48:49
Note: negated condition.
| |
| 1197 a.Return(result); | 1197 a.Return(result); |
| 1198 } | 1198 } |
| 1199 } | 1199 } |
| 1200 | 1200 |
| 1201 namespace { | 1201 namespace { |
| 1202 | 1202 |
| 1203 Node* AdvanceStringIndex(CodeStubAssembler* a, Node* const string, | 1203 Node* AdvanceStringIndex(CodeStubAssembler* a, Node* const string, |
| 1204 Node* const index, Node* const is_unicode) { | 1204 Node* const index, Node* const is_unicode) { |
| 1205 CVariable var_result(a, MachineRepresentation::kTagged); | 1205 CVariable var_result(a, MachineRepresentation::kTagged); |
| 1206 | 1206 |
| (...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2440 a.Bind(&if_matched); | 2440 a.Bind(&if_matched); |
| 2441 { | 2441 { |
| 2442 Node* result = ConstructNewResultFromMatchInfo(isolate, &a, context, | 2442 Node* result = ConstructNewResultFromMatchInfo(isolate, &a, context, |
| 2443 match_indices, string); | 2443 match_indices, string); |
| 2444 a.Return(result); | 2444 a.Return(result); |
| 2445 } | 2445 } |
| 2446 } | 2446 } |
| 2447 | 2447 |
| 2448 } // namespace internal | 2448 } // namespace internal |
| 2449 } // namespace v8 | 2449 } // namespace v8 |
| OLD | NEW |