OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 | 4 |
5 | 5 |
6 #ifdef V8_I18N_SUPPORT | 6 #ifdef V8_I18N_SUPPORT |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/api-natives.h" | 9 #include "src/api-natives.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 ApiNatives::InstantiateObject(break_iterator_template)); | 619 ApiNatives::InstantiateObject(break_iterator_template)); |
620 | 620 |
621 // Set break iterator as internal field of the resulting JS object. | 621 // Set break iterator as internal field of the resulting JS object. |
622 icu::BreakIterator* break_iterator = BreakIterator::InitializeBreakIterator( | 622 icu::BreakIterator* break_iterator = BreakIterator::InitializeBreakIterator( |
623 isolate, locale, options, resolved); | 623 isolate, locale, options, resolved); |
624 | 624 |
625 if (!break_iterator) return isolate->ThrowIllegalOperation(); | 625 if (!break_iterator) return isolate->ThrowIllegalOperation(); |
626 | 626 |
627 local_object->SetInternalField(0, reinterpret_cast<Smi*>(break_iterator)); | 627 local_object->SetInternalField(0, reinterpret_cast<Smi*>(break_iterator)); |
628 // Make sure that the pointer to adopted text is NULL. | 628 // Make sure that the pointer to adopted text is NULL. |
629 local_object->SetInternalField(1, reinterpret_cast<Smi*>(NULL)); | 629 local_object->SetInternalField(1, static_cast<Smi*>(nullptr)); |
630 | 630 |
631 Factory* factory = isolate->factory(); | 631 Factory* factory = isolate->factory(); |
632 Handle<String> key = factory->NewStringFromStaticChars("breakIterator"); | 632 Handle<String> key = factory->NewStringFromStaticChars("breakIterator"); |
633 Handle<String> value = factory->NewStringFromStaticChars("valid"); | 633 Handle<String> value = factory->NewStringFromStaticChars("valid"); |
634 JSObject::AddProperty(local_object, key, value, NONE); | 634 JSObject::AddProperty(local_object, key, value, NONE); |
635 | 635 |
636 // Make object handle weak so we can delete the break iterator once GC kicks | 636 // Make object handle weak so we can delete the break iterator once GC kicks |
637 // in. | 637 // in. |
638 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); | 638 Handle<Object> wrapper = isolate->global_handles()->Create(*local_object); |
639 GlobalHandles::MakeWeak(wrapper.location(), | 639 GlobalHandles::MakeWeak(wrapper.location(), |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) { | 742 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) { |
743 return *isolate->factory()->NewStringFromStaticChars("ideo"); | 743 return *isolate->factory()->NewStringFromStaticChars("ideo"); |
744 } else { | 744 } else { |
745 return *isolate->factory()->NewStringFromStaticChars("unknown"); | 745 return *isolate->factory()->NewStringFromStaticChars("unknown"); |
746 } | 746 } |
747 } | 747 } |
748 } // namespace internal | 748 } // namespace internal |
749 } // namespace v8 | 749 } // namespace v8 |
750 | 750 |
751 #endif // V8_I18N_SUPPORT | 751 #endif // V8_I18N_SUPPORT |
OLD | NEW |