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

Unified Diff: src/bootstrapper.cc

Issue 2586763002: [intl] Create the Intl constructors to C++ (Closed)
Patch Set: Fix factory references 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') | test/intl/toStringTag.js » ('J')
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 e20baf0ec8e6975961807fb487cc88df78825f90..7fb0eaeb6776290e52e7992169c4629a0e102005 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -2324,6 +2324,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);
Yang 2016/12/21 13:23:13 What's the point of installing half the function h
Dan Ehrenberg 2016/12/21 13:41:35 In a follow-on patch, i'll change the allocated ob
+ 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') | test/intl/toStringTag.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698