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

Unified Diff: src/bootstrapper.cc

Issue 2302773002: [regexp] Port RegExpConstructor (Closed)
Patch Set: Tweaks Created 4 years, 3 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 | « BUILD.gn ('k') | 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 551062a8718d53eef420810233e380f71c299302..4fc3fbc282e16310da6ae8b7f6dcca8765f03621 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1575,14 +1575,23 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
{ // -- R e g E x p
// Builtin functions for RegExp.prototype.
- Handle<JSFunction> regexp_fun =
- InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize,
- isolate->initial_object_prototype(),
- Builtins::kIllegal);
+ Handle<JSFunction> regexp_fun = InstallFunction(
+ global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize,
+ isolate->initial_object_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);
+
+ Handle<JSObject> proto =
+ factory->NewJSObject(isolate->object_function(), TENURED);
+ JSObject::AddProperty(proto, factory->constructor_string(), regexp_fun,
+ DONT_ENUM);
+ Accessors::FunctionSetPrototype(regexp_fun, proto).Assert();
DCHECK(regexp_fun->has_initial_map());
Handle<Map> initial_map(regexp_fun->initial_map());
« no previous file with comments | « BUILD.gn ('k') | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698