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

Unified Diff: src/builtins/builtins-string.cc

Issue 2407793002: Revert of [builtins] Move StringIncludes to a builtin. (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/builtins/builtins.h ('k') | src/js/string.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-string.cc
diff --git a/src/builtins/builtins-string.cc b/src/builtins/builtins-string.cc
index e16273cb4eeca41448f43a7b47f1fefb8635c261..238c760b5fbb43ffdcb0ab7d2fc971ddc3bbee23 100644
--- a/src/builtins/builtins-string.cc
+++ b/src/builtins/builtins-string.cc
@@ -781,42 +781,6 @@
assembler->Return(result);
}
-// ES6 section 21.1.3.7
-// String.prototype.includes ( searchString [ , position ] )
-BUILTIN(StringPrototypeIncludes) {
- HandleScope handle_scope(isolate);
- TO_THIS_STRING(str, "String.prototype.includes");
-
- Handle<Object> search = args.atOrUndefined(isolate, 1);
- if (search->IsObject()) {
- Handle<Symbol> match_name = isolate->factory()->match_symbol();
- Handle<Object> match_property;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, match_property,
- Object::GetProperty(search, match_name));
- if (!match_property->IsUndefined(isolate) &&
- match_property->BooleanValue()) {
- THROW_NEW_ERROR_RETURN_FAILURE(
- isolate, NewTypeError(MessageTemplate::kFirstArgumentNotRegExp,
- isolate->factory()->NewStringFromStaticChars(
- "String.prototype.includes")));
- }
- }
- Handle<String> search_string;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, search_string,
- Object::ToString(isolate, search));
- Handle<Object> position;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, position,
- Object::ToInteger(isolate, args.atOrUndefined(isolate, 2)));
-
- double index = std::max(position->Number(), 0.0);
- index = std::min(index, static_cast<double>(str->length()));
-
- int index_in_str = String::IndexOf(isolate, str, search_string,
- static_cast<uint32_t>(index));
- return *isolate->factory()->ToBoolean(index_in_str != -1);
-}
-
// ES6 section 21.1.3.8 String.prototype.indexOf ( searchString [ , position ] )
BUILTIN(StringPrototypeIndexOf) {
HandleScope handle_scope(isolate);
« no previous file with comments | « src/builtins/builtins.h ('k') | src/js/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698