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

Unified Diff: src/regexp/regexp-utils.cc

Issue 2438283002: Revert of [regexp] Use consistent map checks for fast paths (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/regexp/regexp-utils.h ('k') | src/runtime/runtime-regexp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp/regexp-utils.cc
diff --git a/src/regexp/regexp-utils.cc b/src/regexp/regexp-utils.cc
index 7309afa12176109e45b86cbcf5061544684478d8..7f54cf97f932bab5fcf4258cee7685f25c5834b8 100644
--- a/src/regexp/regexp-utils.cc
+++ b/src/regexp/regexp-utils.cc
@@ -136,24 +136,13 @@
return Just(object->IsJSRegExp());
}
-bool RegExpUtils::IsUnmodifiedRegExp(Isolate* isolate, Handle<Object> obj) {
- // TODO(ishell): Update this check once map changes for constant field
- // tracking are landing.
+bool RegExpUtils::IsBuiltinExec(Handle<Object> exec) {
+ if (!exec->IsJSFunction()) return false;
- if (!obj->IsJSReceiver()) return false;
+ Code* code = Handle<JSFunction>::cast(exec)->code();
+ if (code == nullptr) return false;
- JSReceiver* recv = JSReceiver::cast(*obj);
-
- // Check the receiver's map.
- Handle<JSFunction> regexp_function = isolate->regexp_function();
- if (recv->map() != regexp_function->initial_map()) return false;
-
- // Check the receiver's prototype's map.
- Object* proto = recv->map()->prototype();
- if (!proto->IsJSReceiver()) return false;
-
- Handle<Map> initial_proto_initial_map = isolate->regexp_prototype_map();
- return (JSReceiver::cast(proto)->map() == *initial_proto_initial_map);
+ return (code->builtin_index() == Builtins::kRegExpPrototypeExec);
}
int RegExpUtils::AdvanceStringIndex(Isolate* isolate, Handle<String> string,
« no previous file with comments | « src/regexp/regexp-utils.h ('k') | src/runtime/runtime-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698