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

Unified Diff: src/extensions/i18n/i18n-utils.cc

Issue 131363008: A64: Synchronize with r15922. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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 | « src/deoptimizer.cc ('k') | src/factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/extensions/i18n/i18n-utils.cc
diff --git a/src/extensions/i18n/i18n-utils.cc b/src/extensions/i18n/i18n-utils.cc
index b720329f8b6f2446cd0e9b4f3171bfbfd89b0f80..eac11669047ec407e57c78d4038716a0a7bc18ee 100644
--- a/src/extensions/i18n/i18n-utils.cc
+++ b/src/extensions/i18n/i18n-utils.cc
@@ -142,40 +142,34 @@ void Utils::AsciiToUChar(const char* source,
// static
-// Chrome Linux doesn't like static initializers in class, so we create
-// template on demand.
v8::Local<v8::ObjectTemplate> Utils::GetTemplate(v8::Isolate* isolate) {
- static v8::Persistent<v8::ObjectTemplate> icu_template;
-
- if (icu_template.IsEmpty()) {
+ i::Isolate* internal = reinterpret_cast<i::Isolate*>(isolate);
+ if (internal->heap()->i18n_template_one() ==
+ internal->heap()->the_hole_value()) {
v8::Local<v8::ObjectTemplate> raw_template(v8::ObjectTemplate::New());
-
- // Set aside internal field for ICU class.
raw_template->SetInternalFieldCount(1);
-
- icu_template.Reset(isolate, raw_template);
+ internal->heap()
+ ->SetI18nTemplateOne(*v8::Utils::OpenHandle(*raw_template));
}
- return v8::Local<v8::ObjectTemplate>::New(isolate, icu_template);
+ return v8::Utils::ToLocal(i::Handle<i::ObjectTemplateInfo>::cast(
+ internal->factory()->i18n_template_one()));
}
// static
-// Chrome Linux doesn't like static initializers in class, so we create
-// template on demand. This one has 2 internal fields.
v8::Local<v8::ObjectTemplate> Utils::GetTemplate2(v8::Isolate* isolate) {
- static v8::Persistent<v8::ObjectTemplate> icu_template_2;
-
- if (icu_template_2.IsEmpty()) {
+ i::Isolate* internal = reinterpret_cast<i::Isolate*>(isolate);
+ if (internal->heap()->i18n_template_two() ==
+ internal->heap()->the_hole_value()) {
v8::Local<v8::ObjectTemplate> raw_template(v8::ObjectTemplate::New());
-
- // Set aside internal field for ICU class and additional data.
raw_template->SetInternalFieldCount(2);
-
- icu_template_2.Reset(isolate, raw_template);
+ internal->heap()
+ ->SetI18nTemplateTwo(*v8::Utils::OpenHandle(*raw_template));
}
- return v8::Local<v8::ObjectTemplate>::New(isolate, icu_template_2);
+ return v8::Utils::ToLocal(i::Handle<i::ObjectTemplateInfo>::cast(
+ internal->factory()->i18n_template_two()));
}
} // namespace v8_i18n
« no previous file with comments | « src/deoptimizer.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698