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

Unified Diff: src/bootstrapper.cc

Issue 2384613004: [regexp] Port RegExpConstructor to C++ (Closed)
Patch Set: Rebase 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 1fda7ae64e6051e372d735d48109f990b941ab36..0189e77d15427161350a4df5bc7faf036ad52d17 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1649,11 +1649,24 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
factory->NewJSObject(isolate->object_function(), TENURED);
Handle<JSFunction> regexp_fun =
InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize,
- prototype, Builtins::kIllegal);
+ prototype, Builtins::kRegExpConstructor);
InstallWithIntrinsicDefaultProto(isolate, regexp_fun,
Context::REGEXP_FUNCTION_INDEX);
- regexp_fun->shared()->SetConstructStub(
- *isolate->builtins()->JSBuiltinsConstructStub());
+
+ Handle<SharedFunctionInfo> shared(regexp_fun->shared(), isolate);
+ shared->SetConstructStub(*isolate->builtins()->RegExpConstructor());
+ shared->set_instance_class_name(isolate->heap()->RegExp_string());
+ shared->DontAdaptArguments();
+ shared->set_length(2);
+
+ // RegExp.prototype setup.
+
+ // Install the "constructor" property on the {prototype}.
+ JSObject::AddProperty(prototype, factory->constructor_string(), regexp_fun,
+ DONT_ENUM);
+
+ SimpleInstallFunction(prototype, "exec", Builtins::kRegExpPrototypeExec, 1,
+ true, DONT_ENUM);
DCHECK(regexp_fun->has_initial_map());
Handle<Map> initial_map(regexp_fun->initial_map());
@@ -1675,15 +1688,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
initial_map->set_unused_property_fields(0);
initial_map->set_instance_size(initial_map->instance_size() +
num_fields * kPointerSize);
-
- // RegExp.prototype setup.
-
- // Install the "constructor" property on the {prototype}.
- JSObject::AddProperty(prototype, factory->constructor_string(), regexp_fun,
- DONT_ENUM);
-
- SimpleInstallFunction(prototype, "exec", Builtins::kRegExpPrototypeExec, 1,
- true, DONT_ENUM);
}
{ // -- E r r o r
« 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