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

Unified Diff: src/bootstrapper.cc

Issue 1701273003: [builtins] Migrate the leftover Boolean setup to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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.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 091e2019050bd6927c6bb344bb0f0952c7d28888..e93223e91fa7655f43a2c0da9f64ced0ddb6bdfe 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1244,6 +1244,22 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
boolean_fun->shared()->set_length(1);
InstallWithIntrinsicDefaultProto(isolate, boolean_fun,
Context::BOOLEAN_FUNCTION_INDEX);
+
+ // Create the %BooleanPrototype%
+ Handle<JSValue> prototype =
+ Handle<JSValue>::cast(factory->NewJSObject(boolean_fun, TENURED));
+ prototype->set_value(isolate->heap()->false_value());
+ Accessors::FunctionSetPrototype(boolean_fun, prototype).Assert();
+
+ // Install the "constructor" property on the {prototype}.
+ JSObject::AddProperty(prototype, factory->constructor_string(), boolean_fun,
+ DONT_ENUM);
+
+ // Install the Boolean.prototype methods.
+ SimpleInstallFunction(prototype, "toString",
+ Builtins::kBooleanPrototypeToString, 0, false);
+ SimpleInstallFunction(prototype, "valueOf",
+ Builtins::kBooleanPrototypeValueOf, 0, false);
}
{ // --- S t r i n g ---
« no previous file with comments | « no previous file | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698