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 2026643003: [json] replace remaining json.js code with C++ builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix error message Created 4 years, 7 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.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 096ee63b2e5243605a7b1d42405d79cf16874279..7e9ee0f7ff15b432e98943296013a7471e60fb2c 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1475,6 +1475,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
0, true);
SimpleInstallFunction(prototype, "setYear", Builtins::kDatePrototypeSetYear,
1, false);
+ SimpleInstallFunction(prototype, "toJSON", Builtins::kDatePrototypeToJson,
+ 1, false);
// Install i18n fallback functions.
SimpleInstallFunction(prototype, "toLocaleString",
@@ -1601,8 +1603,13 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<JSObject> json_object = factory->NewJSObject(cons, TENURED);
DCHECK(json_object->IsJSObject());
JSObject::AddProperty(global, name, json_object, DONT_ENUM);
+ SimpleInstallFunction(json_object, "parse", Builtins::kJsonParse, 2, true);
SimpleInstallFunction(json_object, "stringify", Builtins::kJsonStringify, 3,
true);
+ JSObject::AddProperty(
+ json_object, factory->to_string_tag_symbol(),
+ factory->NewStringFromAsciiChecked("JSON"),
+ static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
}
{ // -- M a t h
« no previous file with comments | « BUILD.gn ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698