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, |