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

Unified Diff: src/bootstrapper.cc

Issue 2586763002: [intl] Create the Intl constructors to C++ (Closed)
Patch Set: Fix long lines more Created 4 years 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/js/i18n.js » ('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 fe4721617cd8a2ffa3be6f6448fdd28f5d876907..959dc0fa0a9a8dc5b1c59977823c254044d6d963 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -2326,6 +2326,74 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
}
+#ifdef V8_I18N_SUPPORT
+ { // -- I n t l
+ Handle<String> name = factory->InternalizeUtf8String("Intl");
+ Handle<JSFunction> cons = factory->NewFunction(name);
+ JSFunction::SetInstancePrototype(
+ cons,
+ Handle<Object>(native_context()->initial_object_prototype(), isolate));
+ Handle<JSObject> intl = factory->NewJSObject(cons, TENURED);
+ DCHECK(intl->IsJSObject());
+ JSObject::AddProperty(global, name, intl, DONT_ENUM);
+
+ Handle<JSObject> date_time_format_prototype =
+ factory->NewJSObject(isolate->object_function(), TENURED);
+ // Install the @@toStringTag property on the {prototype}.
+ JSObject::AddProperty(
+ date_time_format_prototype, factory->to_string_tag_symbol(),
+ factory->Object_string(),
+ static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
+ Handle<JSFunction> date_time_format_constructor = InstallFunction(
+ intl, "DateTimeFormat", JS_OBJECT_TYPE, JSObject::kHeaderSize,
+ date_time_format_prototype, Builtins::kIllegal);
+ JSObject::AddProperty(date_time_format_prototype,
+ factory->constructor_string(),
+ date_time_format_constructor, DONT_ENUM);
+
+ Handle<JSObject> number_format_prototype =
+ factory->NewJSObject(isolate->object_function(), TENURED);
+ // Install the @@toStringTag property on the {prototype}.
+ JSObject::AddProperty(
+ number_format_prototype, factory->to_string_tag_symbol(),
+ factory->Object_string(),
+ static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
+ Handle<JSFunction> number_format_constructor = InstallFunction(
+ intl, "NumberFormat", JS_OBJECT_TYPE, JSObject::kHeaderSize,
+ number_format_prototype, Builtins::kIllegal);
+ JSObject::AddProperty(number_format_prototype,
+ factory->constructor_string(),
+ number_format_constructor, DONT_ENUM);
+
+ Handle<JSObject> collator_prototype =
+ factory->NewJSObject(isolate->object_function(), TENURED);
+ // Install the @@toStringTag property on the {prototype}.
+ JSObject::AddProperty(
+ collator_prototype, factory->to_string_tag_symbol(),
+ factory->Object_string(),
+ static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
+ Handle<JSFunction> collator_constructor =
+ InstallFunction(intl, "Collator", JS_OBJECT_TYPE, JSObject::kHeaderSize,
+ collator_prototype, Builtins::kIllegal);
+ JSObject::AddProperty(collator_prototype, factory->constructor_string(),
+ collator_constructor, DONT_ENUM);
+
+ Handle<JSObject> v8_break_iterator_prototype =
+ factory->NewJSObject(isolate->object_function(), TENURED);
+ // Install the @@toStringTag property on the {prototype}.
+ JSObject::AddProperty(
+ v8_break_iterator_prototype, factory->to_string_tag_symbol(),
+ factory->Object_string(),
+ static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
+ Handle<JSFunction> v8_break_iterator_constructor = InstallFunction(
+ intl, "v8BreakIterator", JS_OBJECT_TYPE, JSObject::kHeaderSize,
+ v8_break_iterator_prototype, Builtins::kIllegal);
+ JSObject::AddProperty(v8_break_iterator_prototype,
+ factory->constructor_string(),
+ v8_break_iterator_constructor, DONT_ENUM);
+ }
+#endif // V8_I18N_SUPPORT
+
{ // -- A r r a y B u f f e r
Handle<JSFunction> array_buffer_fun = InstallArrayBuffer(
global, "ArrayBuffer", Builtins::kArrayBufferPrototypeGetByteLength,
« no previous file with comments | « no previous file | src/js/i18n.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698