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

Side by Side Diff: src/i18n.cc

Issue 390833003: Remove PropertyAttributes from SetProperty (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/factory.cc ('k') | src/ic.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // limitations under the License. 4 // limitations under the License.
5 5
6 #include "src/i18n.h" 6 #include "src/i18n.h"
7 7
8 #include "unicode/brkiter.h" 8 #include "unicode/brkiter.h"
9 #include "unicode/calendar.h" 9 #include "unicode/calendar.h"
10 #include "unicode/coll.h" 10 #include "unicode/coll.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 UErrorCode status = U_ZERO_ERROR; 130 UErrorCode status = U_ZERO_ERROR;
131 icu::UnicodeString pattern; 131 icu::UnicodeString pattern;
132 date_format->toPattern(pattern); 132 date_format->toPattern(pattern);
133 JSObject::SetProperty( 133 JSObject::SetProperty(
134 resolved, 134 resolved,
135 factory->NewStringFromStaticAscii("pattern"), 135 factory->NewStringFromStaticAscii("pattern"),
136 factory->NewStringFromTwoByte( 136 factory->NewStringFromTwoByte(
137 Vector<const uint16_t>( 137 Vector<const uint16_t>(
138 reinterpret_cast<const uint16_t*>(pattern.getBuffer()), 138 reinterpret_cast<const uint16_t*>(pattern.getBuffer()),
139 pattern.length())).ToHandleChecked(), 139 pattern.length())).ToHandleChecked(),
140 NONE,
141 SLOPPY).Assert(); 140 SLOPPY).Assert();
142 141
143 // Set time zone and calendar. 142 // Set time zone and calendar.
144 const icu::Calendar* calendar = date_format->getCalendar(); 143 const icu::Calendar* calendar = date_format->getCalendar();
145 const char* calendar_name = calendar->getType(); 144 const char* calendar_name = calendar->getType();
146 JSObject::SetProperty( 145 JSObject::SetProperty(
147 resolved, 146 resolved,
148 factory->NewStringFromStaticAscii("calendar"), 147 factory->NewStringFromStaticAscii("calendar"),
149 factory->NewStringFromAsciiChecked(calendar_name), 148 factory->NewStringFromAsciiChecked(calendar_name),
150 NONE,
151 SLOPPY).Assert(); 149 SLOPPY).Assert();
152 150
153 const icu::TimeZone& tz = calendar->getTimeZone(); 151 const icu::TimeZone& tz = calendar->getTimeZone();
154 icu::UnicodeString time_zone; 152 icu::UnicodeString time_zone;
155 tz.getID(time_zone); 153 tz.getID(time_zone);
156 154
157 icu::UnicodeString canonical_time_zone; 155 icu::UnicodeString canonical_time_zone;
158 icu::TimeZone::getCanonicalID(time_zone, canonical_time_zone, status); 156 icu::TimeZone::getCanonicalID(time_zone, canonical_time_zone, status);
159 if (U_SUCCESS(status)) { 157 if (U_SUCCESS(status)) {
160 if (canonical_time_zone == UNICODE_STRING_SIMPLE("Etc/GMT")) { 158 if (canonical_time_zone == UNICODE_STRING_SIMPLE("Etc/GMT")) {
161 JSObject::SetProperty( 159 JSObject::SetProperty(
162 resolved, 160 resolved,
163 factory->NewStringFromStaticAscii("timeZone"), 161 factory->NewStringFromStaticAscii("timeZone"),
164 factory->NewStringFromStaticAscii("UTC"), 162 factory->NewStringFromStaticAscii("UTC"),
165 NONE,
166 SLOPPY).Assert(); 163 SLOPPY).Assert();
167 } else { 164 } else {
168 JSObject::SetProperty( 165 JSObject::SetProperty(
169 resolved, 166 resolved,
170 factory->NewStringFromStaticAscii("timeZone"), 167 factory->NewStringFromStaticAscii("timeZone"),
171 factory->NewStringFromTwoByte( 168 factory->NewStringFromTwoByte(
172 Vector<const uint16_t>( 169 Vector<const uint16_t>(
173 reinterpret_cast<const uint16_t*>( 170 reinterpret_cast<const uint16_t*>(
174 canonical_time_zone.getBuffer()), 171 canonical_time_zone.getBuffer()),
175 canonical_time_zone.length())).ToHandleChecked(), 172 canonical_time_zone.length())).ToHandleChecked(),
176 NONE,
177 SLOPPY).Assert(); 173 SLOPPY).Assert();
178 } 174 }
179 } 175 }
180 176
181 // Ugly hack. ICU doesn't expose numbering system in any way, so we have 177 // Ugly hack. ICU doesn't expose numbering system in any way, so we have
182 // to assume that for given locale NumberingSystem constructor produces the 178 // to assume that for given locale NumberingSystem constructor produces the
183 // same digits as NumberFormat/Calendar would. 179 // same digits as NumberFormat/Calendar would.
184 status = U_ZERO_ERROR; 180 status = U_ZERO_ERROR;
185 icu::NumberingSystem* numbering_system = 181 icu::NumberingSystem* numbering_system =
186 icu::NumberingSystem::createInstance(icu_locale, status); 182 icu::NumberingSystem::createInstance(icu_locale, status);
187 if (U_SUCCESS(status)) { 183 if (U_SUCCESS(status)) {
188 const char* ns = numbering_system->getName(); 184 const char* ns = numbering_system->getName();
189 JSObject::SetProperty( 185 JSObject::SetProperty(
190 resolved, 186 resolved,
191 factory->NewStringFromStaticAscii("numberingSystem"), 187 factory->NewStringFromStaticAscii("numberingSystem"),
192 factory->NewStringFromAsciiChecked(ns), 188 factory->NewStringFromAsciiChecked(ns),
193 NONE,
194 SLOPPY).Assert(); 189 SLOPPY).Assert();
195 } else { 190 } else {
196 JSObject::SetProperty( 191 JSObject::SetProperty(
197 resolved, 192 resolved,
198 factory->NewStringFromStaticAscii("numberingSystem"), 193 factory->NewStringFromStaticAscii("numberingSystem"),
199 factory->undefined_value(), 194 factory->undefined_value(),
200 NONE,
201 SLOPPY).Assert(); 195 SLOPPY).Assert();
202 } 196 }
203 delete numbering_system; 197 delete numbering_system;
204 198
205 // Set the locale 199 // Set the locale
206 char result[ULOC_FULLNAME_CAPACITY]; 200 char result[ULOC_FULLNAME_CAPACITY];
207 status = U_ZERO_ERROR; 201 status = U_ZERO_ERROR;
208 uloc_toLanguageTag( 202 uloc_toLanguageTag(
209 icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); 203 icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status);
210 if (U_SUCCESS(status)) { 204 if (U_SUCCESS(status)) {
211 JSObject::SetProperty( 205 JSObject::SetProperty(
212 resolved, 206 resolved,
213 factory->NewStringFromStaticAscii("locale"), 207 factory->NewStringFromStaticAscii("locale"),
214 factory->NewStringFromAsciiChecked(result), 208 factory->NewStringFromAsciiChecked(result),
215 NONE,
216 SLOPPY).Assert(); 209 SLOPPY).Assert();
217 } else { 210 } else {
218 // This would never happen, since we got the locale from ICU. 211 // This would never happen, since we got the locale from ICU.
219 JSObject::SetProperty( 212 JSObject::SetProperty(
220 resolved, 213 resolved,
221 factory->NewStringFromStaticAscii("locale"), 214 factory->NewStringFromStaticAscii("locale"),
222 factory->NewStringFromStaticAscii("und"), 215 factory->NewStringFromStaticAscii("und"),
223 NONE,
224 SLOPPY).Assert(); 216 SLOPPY).Assert();
225 } 217 }
226 } 218 }
227 219
228 220
229 template<int internal_fields, EternalHandles::SingletonHandle field> 221 template<int internal_fields, EternalHandles::SingletonHandle field>
230 Handle<ObjectTemplateInfo> GetEternal(Isolate* isolate) { 222 Handle<ObjectTemplateInfo> GetEternal(Isolate* isolate) {
231 if (isolate->eternal_handles()->Exists(field)) { 223 if (isolate->eternal_handles()->Exists(field)) {
232 return Handle<ObjectTemplateInfo>::cast( 224 return Handle<ObjectTemplateInfo>::cast(
233 isolate->eternal_handles()->GetSingleton(field)); 225 isolate->eternal_handles()->GetSingleton(field));
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 Factory* factory = isolate->factory(); 349 Factory* factory = isolate->factory();
358 icu::UnicodeString pattern; 350 icu::UnicodeString pattern;
359 number_format->toPattern(pattern); 351 number_format->toPattern(pattern);
360 JSObject::SetProperty( 352 JSObject::SetProperty(
361 resolved, 353 resolved,
362 factory->NewStringFromStaticAscii("pattern"), 354 factory->NewStringFromStaticAscii("pattern"),
363 factory->NewStringFromTwoByte( 355 factory->NewStringFromTwoByte(
364 Vector<const uint16_t>( 356 Vector<const uint16_t>(
365 reinterpret_cast<const uint16_t*>(pattern.getBuffer()), 357 reinterpret_cast<const uint16_t*>(pattern.getBuffer()),
366 pattern.length())).ToHandleChecked(), 358 pattern.length())).ToHandleChecked(),
367 NONE,
368 SLOPPY).Assert(); 359 SLOPPY).Assert();
369 360
370 // Set resolved currency code in options.currency if not empty. 361 // Set resolved currency code in options.currency if not empty.
371 icu::UnicodeString currency(number_format->getCurrency()); 362 icu::UnicodeString currency(number_format->getCurrency());
372 if (!currency.isEmpty()) { 363 if (!currency.isEmpty()) {
373 JSObject::SetProperty( 364 JSObject::SetProperty(
374 resolved, 365 resolved,
375 factory->NewStringFromStaticAscii("currency"), 366 factory->NewStringFromStaticAscii("currency"),
376 factory->NewStringFromTwoByte( 367 factory->NewStringFromTwoByte(
377 Vector<const uint16_t>( 368 Vector<const uint16_t>(
378 reinterpret_cast<const uint16_t*>(currency.getBuffer()), 369 reinterpret_cast<const uint16_t*>(currency.getBuffer()),
379 currency.length())).ToHandleChecked(), 370 currency.length())).ToHandleChecked(),
380 NONE,
381 SLOPPY).Assert(); 371 SLOPPY).Assert();
382 } 372 }
383 373
384 // Ugly hack. ICU doesn't expose numbering system in any way, so we have 374 // Ugly hack. ICU doesn't expose numbering system in any way, so we have
385 // to assume that for given locale NumberingSystem constructor produces the 375 // to assume that for given locale NumberingSystem constructor produces the
386 // same digits as NumberFormat/Calendar would. 376 // same digits as NumberFormat/Calendar would.
387 UErrorCode status = U_ZERO_ERROR; 377 UErrorCode status = U_ZERO_ERROR;
388 icu::NumberingSystem* numbering_system = 378 icu::NumberingSystem* numbering_system =
389 icu::NumberingSystem::createInstance(icu_locale, status); 379 icu::NumberingSystem::createInstance(icu_locale, status);
390 if (U_SUCCESS(status)) { 380 if (U_SUCCESS(status)) {
391 const char* ns = numbering_system->getName(); 381 const char* ns = numbering_system->getName();
392 JSObject::SetProperty( 382 JSObject::SetProperty(
393 resolved, 383 resolved,
394 factory->NewStringFromStaticAscii("numberingSystem"), 384 factory->NewStringFromStaticAscii("numberingSystem"),
395 factory->NewStringFromAsciiChecked(ns), 385 factory->NewStringFromAsciiChecked(ns),
396 NONE,
397 SLOPPY).Assert(); 386 SLOPPY).Assert();
398 } else { 387 } else {
399 JSObject::SetProperty( 388 JSObject::SetProperty(
400 resolved, 389 resolved,
401 factory->NewStringFromStaticAscii("numberingSystem"), 390 factory->NewStringFromStaticAscii("numberingSystem"),
402 factory->undefined_value(), 391 factory->undefined_value(),
403 NONE,
404 SLOPPY).Assert(); 392 SLOPPY).Assert();
405 } 393 }
406 delete numbering_system; 394 delete numbering_system;
407 395
408 JSObject::SetProperty( 396 JSObject::SetProperty(
409 resolved, 397 resolved,
410 factory->NewStringFromStaticAscii("useGrouping"), 398 factory->NewStringFromStaticAscii("useGrouping"),
411 factory->ToBoolean(number_format->isGroupingUsed()), 399 factory->ToBoolean(number_format->isGroupingUsed()),
412 NONE,
413 SLOPPY).Assert(); 400 SLOPPY).Assert();
414 401
415 JSObject::SetProperty( 402 JSObject::SetProperty(
416 resolved, 403 resolved,
417 factory->NewStringFromStaticAscii("minimumIntegerDigits"), 404 factory->NewStringFromStaticAscii("minimumIntegerDigits"),
418 factory->NewNumberFromInt(number_format->getMinimumIntegerDigits()), 405 factory->NewNumberFromInt(number_format->getMinimumIntegerDigits()),
419 NONE,
420 SLOPPY).Assert(); 406 SLOPPY).Assert();
421 407
422 JSObject::SetProperty( 408 JSObject::SetProperty(
423 resolved, 409 resolved,
424 factory->NewStringFromStaticAscii("minimumFractionDigits"), 410 factory->NewStringFromStaticAscii("minimumFractionDigits"),
425 factory->NewNumberFromInt(number_format->getMinimumFractionDigits()), 411 factory->NewNumberFromInt(number_format->getMinimumFractionDigits()),
426 NONE,
427 SLOPPY).Assert(); 412 SLOPPY).Assert();
428 413
429 JSObject::SetProperty( 414 JSObject::SetProperty(
430 resolved, 415 resolved,
431 factory->NewStringFromStaticAscii("maximumFractionDigits"), 416 factory->NewStringFromStaticAscii("maximumFractionDigits"),
432 factory->NewNumberFromInt(number_format->getMaximumFractionDigits()), 417 factory->NewNumberFromInt(number_format->getMaximumFractionDigits()),
433 NONE,
434 SLOPPY).Assert(); 418 SLOPPY).Assert();
435 419
436 Handle<String> key = 420 Handle<String> key =
437 factory->NewStringFromStaticAscii("minimumSignificantDigits"); 421 factory->NewStringFromStaticAscii("minimumSignificantDigits");
438 if (JSReceiver::HasOwnProperty(resolved, key)) { 422 if (JSReceiver::HasOwnProperty(resolved, key)) {
439 JSObject::SetProperty( 423 JSObject::SetProperty(
440 resolved, 424 resolved,
441 factory->NewStringFromStaticAscii("minimumSignificantDigits"), 425 factory->NewStringFromStaticAscii("minimumSignificantDigits"),
442 factory->NewNumberFromInt(number_format->getMinimumSignificantDigits()), 426 factory->NewNumberFromInt(number_format->getMinimumSignificantDigits()),
443 NONE,
444 SLOPPY).Assert(); 427 SLOPPY).Assert();
445 } 428 }
446 429
447 key = factory->NewStringFromStaticAscii("maximumSignificantDigits"); 430 key = factory->NewStringFromStaticAscii("maximumSignificantDigits");
448 if (JSReceiver::HasOwnProperty(resolved, key)) { 431 if (JSReceiver::HasOwnProperty(resolved, key)) {
449 JSObject::SetProperty( 432 JSObject::SetProperty(
450 resolved, 433 resolved,
451 factory->NewStringFromStaticAscii("maximumSignificantDigits"), 434 factory->NewStringFromStaticAscii("maximumSignificantDigits"),
452 factory->NewNumberFromInt(number_format->getMaximumSignificantDigits()), 435 factory->NewNumberFromInt(number_format->getMaximumSignificantDigits()),
453 NONE,
454 SLOPPY).Assert(); 436 SLOPPY).Assert();
455 } 437 }
456 438
457 // Set the locale 439 // Set the locale
458 char result[ULOC_FULLNAME_CAPACITY]; 440 char result[ULOC_FULLNAME_CAPACITY];
459 status = U_ZERO_ERROR; 441 status = U_ZERO_ERROR;
460 uloc_toLanguageTag( 442 uloc_toLanguageTag(
461 icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); 443 icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status);
462 if (U_SUCCESS(status)) { 444 if (U_SUCCESS(status)) {
463 JSObject::SetProperty( 445 JSObject::SetProperty(
464 resolved, 446 resolved,
465 factory->NewStringFromStaticAscii("locale"), 447 factory->NewStringFromStaticAscii("locale"),
466 factory->NewStringFromAsciiChecked(result), 448 factory->NewStringFromAsciiChecked(result),
467 NONE,
468 SLOPPY).Assert(); 449 SLOPPY).Assert();
469 } else { 450 } else {
470 // This would never happen, since we got the locale from ICU. 451 // This would never happen, since we got the locale from ICU.
471 JSObject::SetProperty( 452 JSObject::SetProperty(
472 resolved, 453 resolved,
473 factory->NewStringFromStaticAscii("locale"), 454 factory->NewStringFromStaticAscii("locale"),
474 factory->NewStringFromStaticAscii("und"), 455 factory->NewStringFromStaticAscii("und"),
475 NONE,
476 SLOPPY).Assert(); 456 SLOPPY).Assert();
477 } 457 }
478 } 458 }
479 459
480 460
481 icu::Collator* CreateICUCollator( 461 icu::Collator* CreateICUCollator(
482 Isolate* isolate, 462 Isolate* isolate,
483 const icu::Locale& icu_locale, 463 const icu::Locale& icu_locale,
484 Handle<JSObject> options) { 464 Handle<JSObject> options) {
485 // Make collator from options. 465 // Make collator from options.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 icu::Collator* collator, 527 icu::Collator* collator,
548 Handle<JSObject> resolved) { 528 Handle<JSObject> resolved) {
549 Factory* factory = isolate->factory(); 529 Factory* factory = isolate->factory();
550 UErrorCode status = U_ZERO_ERROR; 530 UErrorCode status = U_ZERO_ERROR;
551 531
552 JSObject::SetProperty( 532 JSObject::SetProperty(
553 resolved, 533 resolved,
554 factory->NewStringFromStaticAscii("numeric"), 534 factory->NewStringFromStaticAscii("numeric"),
555 factory->ToBoolean( 535 factory->ToBoolean(
556 collator->getAttribute(UCOL_NUMERIC_COLLATION, status) == UCOL_ON), 536 collator->getAttribute(UCOL_NUMERIC_COLLATION, status) == UCOL_ON),
557 NONE,
558 SLOPPY).Assert(); 537 SLOPPY).Assert();
559 538
560 switch (collator->getAttribute(UCOL_CASE_FIRST, status)) { 539 switch (collator->getAttribute(UCOL_CASE_FIRST, status)) {
561 case UCOL_LOWER_FIRST: 540 case UCOL_LOWER_FIRST:
562 JSObject::SetProperty( 541 JSObject::SetProperty(
563 resolved, 542 resolved,
564 factory->NewStringFromStaticAscii("caseFirst"), 543 factory->NewStringFromStaticAscii("caseFirst"),
565 factory->NewStringFromStaticAscii("lower"), 544 factory->NewStringFromStaticAscii("lower"),
566 NONE,
567 SLOPPY).Assert(); 545 SLOPPY).Assert();
568 break; 546 break;
569 case UCOL_UPPER_FIRST: 547 case UCOL_UPPER_FIRST:
570 JSObject::SetProperty( 548 JSObject::SetProperty(
571 resolved, 549 resolved,
572 factory->NewStringFromStaticAscii("caseFirst"), 550 factory->NewStringFromStaticAscii("caseFirst"),
573 factory->NewStringFromStaticAscii("upper"), 551 factory->NewStringFromStaticAscii("upper"),
574 NONE,
575 SLOPPY).Assert(); 552 SLOPPY).Assert();
576 break; 553 break;
577 default: 554 default:
578 JSObject::SetProperty( 555 JSObject::SetProperty(
579 resolved, 556 resolved,
580 factory->NewStringFromStaticAscii("caseFirst"), 557 factory->NewStringFromStaticAscii("caseFirst"),
581 factory->NewStringFromStaticAscii("false"), 558 factory->NewStringFromStaticAscii("false"),
582 NONE,
583 SLOPPY).Assert(); 559 SLOPPY).Assert();
584 } 560 }
585 561
586 switch (collator->getAttribute(UCOL_STRENGTH, status)) { 562 switch (collator->getAttribute(UCOL_STRENGTH, status)) {
587 case UCOL_PRIMARY: { 563 case UCOL_PRIMARY: {
588 JSObject::SetProperty( 564 JSObject::SetProperty(
589 resolved, 565 resolved,
590 factory->NewStringFromStaticAscii("strength"), 566 factory->NewStringFromStaticAscii("strength"),
591 factory->NewStringFromStaticAscii("primary"), 567 factory->NewStringFromStaticAscii("primary"),
592 NONE,
593 SLOPPY).Assert(); 568 SLOPPY).Assert();
594 569
595 // case level: true + s1 -> case, s1 -> base. 570 // case level: true + s1 -> case, s1 -> base.
596 if (UCOL_ON == collator->getAttribute(UCOL_CASE_LEVEL, status)) { 571 if (UCOL_ON == collator->getAttribute(UCOL_CASE_LEVEL, status)) {
597 JSObject::SetProperty( 572 JSObject::SetProperty(
598 resolved, 573 resolved,
599 factory->NewStringFromStaticAscii("sensitivity"), 574 factory->NewStringFromStaticAscii("sensitivity"),
600 factory->NewStringFromStaticAscii("case"), 575 factory->NewStringFromStaticAscii("case"),
601 NONE,
602 SLOPPY).Assert(); 576 SLOPPY).Assert();
603 } else { 577 } else {
604 JSObject::SetProperty( 578 JSObject::SetProperty(
605 resolved, 579 resolved,
606 factory->NewStringFromStaticAscii("sensitivity"), 580 factory->NewStringFromStaticAscii("sensitivity"),
607 factory->NewStringFromStaticAscii("base"), 581 factory->NewStringFromStaticAscii("base"),
608 NONE,
609 SLOPPY).Assert(); 582 SLOPPY).Assert();
610 } 583 }
611 break; 584 break;
612 } 585 }
613 case UCOL_SECONDARY: 586 case UCOL_SECONDARY:
614 JSObject::SetProperty( 587 JSObject::SetProperty(
615 resolved, 588 resolved,
616 factory->NewStringFromStaticAscii("strength"), 589 factory->NewStringFromStaticAscii("strength"),
617 factory->NewStringFromStaticAscii("secondary"), 590 factory->NewStringFromStaticAscii("secondary"),
618 NONE,
619 SLOPPY).Assert(); 591 SLOPPY).Assert();
620 JSObject::SetProperty( 592 JSObject::SetProperty(
621 resolved, 593 resolved,
622 factory->NewStringFromStaticAscii("sensitivity"), 594 factory->NewStringFromStaticAscii("sensitivity"),
623 factory->NewStringFromStaticAscii("accent"), 595 factory->NewStringFromStaticAscii("accent"),
624 NONE,
625 SLOPPY).Assert(); 596 SLOPPY).Assert();
626 break; 597 break;
627 case UCOL_TERTIARY: 598 case UCOL_TERTIARY:
628 JSObject::SetProperty( 599 JSObject::SetProperty(
629 resolved, 600 resolved,
630 factory->NewStringFromStaticAscii("strength"), 601 factory->NewStringFromStaticAscii("strength"),
631 factory->NewStringFromStaticAscii("tertiary"), 602 factory->NewStringFromStaticAscii("tertiary"),
632 NONE,
633 SLOPPY).Assert(); 603 SLOPPY).Assert();
634 JSObject::SetProperty( 604 JSObject::SetProperty(
635 resolved, 605 resolved,
636 factory->NewStringFromStaticAscii("sensitivity"), 606 factory->NewStringFromStaticAscii("sensitivity"),
637 factory->NewStringFromStaticAscii("variant"), 607 factory->NewStringFromStaticAscii("variant"),
638 NONE,
639 SLOPPY).Assert(); 608 SLOPPY).Assert();
640 break; 609 break;
641 case UCOL_QUATERNARY: 610 case UCOL_QUATERNARY:
642 // We shouldn't get quaternary and identical from ICU, but if we do 611 // We shouldn't get quaternary and identical from ICU, but if we do
643 // put them into variant. 612 // put them into variant.
644 JSObject::SetProperty( 613 JSObject::SetProperty(
645 resolved, 614 resolved,
646 factory->NewStringFromStaticAscii("strength"), 615 factory->NewStringFromStaticAscii("strength"),
647 factory->NewStringFromStaticAscii("quaternary"), 616 factory->NewStringFromStaticAscii("quaternary"),
648 NONE,
649 SLOPPY).Assert(); 617 SLOPPY).Assert();
650 JSObject::SetProperty( 618 JSObject::SetProperty(
651 resolved, 619 resolved,
652 factory->NewStringFromStaticAscii("sensitivity"), 620 factory->NewStringFromStaticAscii("sensitivity"),
653 factory->NewStringFromStaticAscii("variant"), 621 factory->NewStringFromStaticAscii("variant"),
654 NONE,
655 SLOPPY).Assert(); 622 SLOPPY).Assert();
656 break; 623 break;
657 default: 624 default:
658 JSObject::SetProperty( 625 JSObject::SetProperty(
659 resolved, 626 resolved,
660 factory->NewStringFromStaticAscii("strength"), 627 factory->NewStringFromStaticAscii("strength"),
661 factory->NewStringFromStaticAscii("identical"), 628 factory->NewStringFromStaticAscii("identical"),
662 NONE,
663 SLOPPY).Assert(); 629 SLOPPY).Assert();
664 JSObject::SetProperty( 630 JSObject::SetProperty(
665 resolved, 631 resolved,
666 factory->NewStringFromStaticAscii("sensitivity"), 632 factory->NewStringFromStaticAscii("sensitivity"),
667 factory->NewStringFromStaticAscii("variant"), 633 factory->NewStringFromStaticAscii("variant"),
668 NONE,
669 SLOPPY).Assert(); 634 SLOPPY).Assert();
670 } 635 }
671 636
672 JSObject::SetProperty( 637 JSObject::SetProperty(
673 resolved, 638 resolved,
674 factory->NewStringFromStaticAscii("ignorePunctuation"), 639 factory->NewStringFromStaticAscii("ignorePunctuation"),
675 factory->ToBoolean(collator->getAttribute( 640 factory->ToBoolean(collator->getAttribute(
676 UCOL_ALTERNATE_HANDLING, status) == UCOL_SHIFTED), 641 UCOL_ALTERNATE_HANDLING, status) == UCOL_SHIFTED),
677 NONE,
678 SLOPPY).Assert(); 642 SLOPPY).Assert();
679 643
680 // Set the locale 644 // Set the locale
681 char result[ULOC_FULLNAME_CAPACITY]; 645 char result[ULOC_FULLNAME_CAPACITY];
682 status = U_ZERO_ERROR; 646 status = U_ZERO_ERROR;
683 uloc_toLanguageTag( 647 uloc_toLanguageTag(
684 icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); 648 icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status);
685 if (U_SUCCESS(status)) { 649 if (U_SUCCESS(status)) {
686 JSObject::SetProperty( 650 JSObject::SetProperty(
687 resolved, 651 resolved,
688 factory->NewStringFromStaticAscii("locale"), 652 factory->NewStringFromStaticAscii("locale"),
689 factory->NewStringFromAsciiChecked(result), 653 factory->NewStringFromAsciiChecked(result),
690 NONE,
691 SLOPPY).Assert(); 654 SLOPPY).Assert();
692 } else { 655 } else {
693 // This would never happen, since we got the locale from ICU. 656 // This would never happen, since we got the locale from ICU.
694 JSObject::SetProperty( 657 JSObject::SetProperty(
695 resolved, 658 resolved,
696 factory->NewStringFromStaticAscii("locale"), 659 factory->NewStringFromStaticAscii("locale"),
697 factory->NewStringFromStaticAscii("und"), 660 factory->NewStringFromStaticAscii("und"),
698 NONE,
699 SLOPPY).Assert(); 661 SLOPPY).Assert();
700 } 662 }
701 } 663 }
702 664
703 665
704 icu::BreakIterator* CreateICUBreakIterator( 666 icu::BreakIterator* CreateICUBreakIterator(
705 Isolate* isolate, 667 Isolate* isolate,
706 const icu::Locale& icu_locale, 668 const icu::Locale& icu_locale,
707 Handle<JSObject> options) { 669 Handle<JSObject> options) {
708 UErrorCode status = U_ZERO_ERROR; 670 UErrorCode status = U_ZERO_ERROR;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 // Set the locale 706 // Set the locale
745 char result[ULOC_FULLNAME_CAPACITY]; 707 char result[ULOC_FULLNAME_CAPACITY];
746 status = U_ZERO_ERROR; 708 status = U_ZERO_ERROR;
747 uloc_toLanguageTag( 709 uloc_toLanguageTag(
748 icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); 710 icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status);
749 if (U_SUCCESS(status)) { 711 if (U_SUCCESS(status)) {
750 JSObject::SetProperty( 712 JSObject::SetProperty(
751 resolved, 713 resolved,
752 factory->NewStringFromStaticAscii("locale"), 714 factory->NewStringFromStaticAscii("locale"),
753 factory->NewStringFromAsciiChecked(result), 715 factory->NewStringFromAsciiChecked(result),
754 NONE,
755 SLOPPY).Assert(); 716 SLOPPY).Assert();
756 } else { 717 } else {
757 // This would never happen, since we got the locale from ICU. 718 // This would never happen, since we got the locale from ICU.
758 JSObject::SetProperty( 719 JSObject::SetProperty(
759 resolved, 720 resolved,
760 factory->NewStringFromStaticAscii("locale"), 721 factory->NewStringFromStaticAscii("locale"),
761 factory->NewStringFromStaticAscii("und"), 722 factory->NewStringFromStaticAscii("und"),
762 NONE,
763 SLOPPY).Assert(); 723 SLOPPY).Assert();
764 } 724 }
765 } 725 }
766 726
767 } // namespace 727 } // namespace
768 728
769 729
770 // static 730 // static
771 Handle<ObjectTemplateInfo> I18N::GetTemplate(Isolate* isolate) { 731 Handle<ObjectTemplateInfo> I18N::GetTemplate(Isolate* isolate) {
772 return GetEternal<1, i::EternalHandles::I18N_TEMPLATE_ONE>(isolate); 732 return GetEternal<1, i::EternalHandles::I18N_TEMPLATE_ONE>(isolate);
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 980
1021 981
1022 void BreakIterator::DeleteBreakIterator( 982 void BreakIterator::DeleteBreakIterator(
1023 const v8::WeakCallbackData<v8::Value, void>& data) { 983 const v8::WeakCallbackData<v8::Value, void>& data) {
1024 DeleteNativeObjectAt<icu::BreakIterator>(data, 0); 984 DeleteNativeObjectAt<icu::BreakIterator>(data, 0);
1025 DeleteNativeObjectAt<icu::UnicodeString>(data, 1); 985 DeleteNativeObjectAt<icu::UnicodeString>(data, 1);
1026 DestroyGlobalHandle(data); 986 DestroyGlobalHandle(data);
1027 } 987 }
1028 988
1029 } } // namespace v8::internal 989 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698