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

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

Issue 2434983002: [regexp] Use consistent map checks for fast paths (Closed)
Patch Set: Unmark coerce-* tests as failing Created 4 years, 2 months 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 | « no previous file | src/regexp/regexp-utils.h » ('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 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 1283
1284 Factory* factory = isolate->factory(); 1284 Factory* factory = isolate->factory();
1285 1285
1286 Handle<Object> string_obj = args.atOrUndefined(isolate, 1); 1286 Handle<Object> string_obj = args.atOrUndefined(isolate, 1);
1287 Handle<Object> limit_obj = args.atOrUndefined(isolate, 2); 1287 Handle<Object> limit_obj = args.atOrUndefined(isolate, 2);
1288 1288
1289 Handle<String> string; 1289 Handle<String> string;
1290 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, string, 1290 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, string,
1291 Object::ToString(isolate, string_obj)); 1291 Object::ToString(isolate, string_obj));
1292 1292
1293 if (RegExpUtils::IsUnmodifiedRegExp(isolate, recv)) {
1294 RETURN_RESULT_OR_FAILURE(
1295 isolate,
1296 RegExpSplit(isolate, Handle<JSRegExp>::cast(recv), string, limit_obj));
1297 }
1298
1293 Handle<JSFunction> regexp_fun = isolate->regexp_function(); 1299 Handle<JSFunction> regexp_fun = isolate->regexp_function();
1294 Handle<Object> ctor; 1300 Handle<Object> ctor;
1295 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1301 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1296 isolate, ctor, SpeciesConstructor(isolate, recv, regexp_fun)); 1302 isolate, ctor, SpeciesConstructor(isolate, recv, regexp_fun));
1297 1303
1298 if (recv->IsJSRegExp() && *ctor == *regexp_fun) {
1299 Handle<Object> exec;
1300 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1301 isolate, exec, JSObject::GetProperty(
1302 recv, factory->NewStringFromAsciiChecked("exec")));
1303 if (RegExpUtils::IsBuiltinExec(exec)) {
1304 RETURN_RESULT_OR_FAILURE(
1305 isolate, RegExpSplit(isolate, Handle<JSRegExp>::cast(recv), string,
1306 limit_obj));
1307 }
1308 }
1309
1310 Handle<Object> flags_obj; 1304 Handle<Object> flags_obj;
1311 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1305 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1312 isolate, flags_obj, JSObject::GetProperty(recv, factory->flags_string())); 1306 isolate, flags_obj, JSObject::GetProperty(recv, factory->flags_string()));
1313 1307
1314 Handle<String> flags; 1308 Handle<String> flags;
1315 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, flags, 1309 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, flags,
1316 Object::ToString(isolate, flags_obj)); 1310 Object::ToString(isolate, flags_obj));
1317 1311
1318 Handle<String> u_str = factory->LookupSingleCharacterStringFromCode('u'); 1312 Handle<String> u_str = factory->LookupSingleCharacterStringFromCode('u');
1319 const bool unicode = (String::IndexOf(isolate, flags, u_str, 0) >= 0); 1313 const bool unicode = (String::IndexOf(isolate, flags, u_str, 0) >= 0);
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 a->Bind(&if_matched); 1689 a->Bind(&if_matched);
1696 { 1690 {
1697 Node* result = ConstructNewResultFromMatchInfo(isolate, a, context, 1691 Node* result = ConstructNewResultFromMatchInfo(isolate, a, context,
1698 match_indices, string); 1692 match_indices, string);
1699 a->Return(result); 1693 a->Return(result);
1700 } 1694 }
1701 } 1695 }
1702 1696
1703 } // namespace internal 1697 } // namespace internal
1704 } // namespace v8 1698 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/regexp/regexp-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698