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

Unified Diff: src/bootstrapper.cc

Issue 2398423002: [regexp] Port RegExp.prototype[@@replace] (Closed)
Patch Set: Smi::kZero 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 | « no previous file | src/builtins/builtins.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 0e56f74e0b8dac811be9884a09e0ab668a94e3c2..ff12defefb3b4c2c448cc2baee863dcce7c4ebc4 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1700,7 +1700,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
shared->set_instance_class_name(isolate->heap()->RegExp_string());
shared->DontAdaptArguments();
shared->set_length(2);
-
{
// RegExp.prototype setup.
@@ -1748,6 +1747,13 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
{
Handle<JSFunction> fun = SimpleCreateFunction(
+ isolate, factory->InternalizeUtf8String("[Symbol.replace]"),
+ Builtins::kRegExpPrototypeReplace, 2, true);
+ InstallFunction(prototype, fun, factory->replace_symbol(), DONT_ENUM);
+ }
+
+ {
+ Handle<JSFunction> fun = SimpleCreateFunction(
isolate, factory->InternalizeUtf8String("[Symbol.search]"),
Builtins::kRegExpPrototypeSearch, 1, false);
InstallFunction(prototype, fun, factory->search_symbol(), DONT_ENUM);
@@ -1759,6 +1765,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Builtins::kRegExpPrototypeSplit, 2, false);
InstallFunction(prototype, fun, factory->split_symbol(), DONT_ENUM);
}
+
+ // Store the initial RegExp.prototype map. This is used in fast-path
+ // checks. Do not alter the prototype after this point.
+ isolate->native_context()->set_regexp_prototype_map(prototype->map());
}
{
« no previous file with comments | « no previous file | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698