| Index: src/runtime/runtime-i18n.cc
|
| diff --git a/src/runtime/runtime-i18n.cc b/src/runtime/runtime-i18n.cc
|
| index faf67e0ac7cb819de11d057077e6536d3dfa712b..8f9a0f227d95a3aff6aae2c91407677bcd287c98 100644
|
| --- a/src/runtime/runtime-i18n.cc
|
| +++ b/src/runtime/runtime-i18n.cc
|
| @@ -6,6 +6,8 @@
|
| #ifdef V8_I18N_SUPPORT
|
| #include "src/runtime/runtime-utils.h"
|
|
|
| +#include <memory>
|
| +
|
| #include "src/api.h"
|
| #include "src/api-natives.h"
|
| #include "src/arguments.h"
|
| @@ -45,12 +47,12 @@ namespace internal {
|
| namespace {
|
|
|
| const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat,
|
| - base::SmartArrayPointer<uc16>* dest,
|
| + std::unique_ptr<uc16[]>* dest,
|
| int32_t length) {
|
| DCHECK(flat.IsFlat());
|
| if (flat.IsOneByte()) {
|
| - if (dest->is_empty()) {
|
| - dest->Reset(NewArray<uc16>(length));
|
| + if (!*dest) {
|
| + dest->reset(NewArray<uc16>(length));
|
| CopyChars(dest->get(), flat.ToOneByteVector().start(), length);
|
| }
|
| return reinterpret_cast<const UChar*>(dest->get());
|
| @@ -578,8 +580,8 @@ RUNTIME_FUNCTION(Runtime_InternalCompare) {
|
| int32_t length2 = string2->length();
|
| String::FlatContent flat1 = string1->GetFlatContent();
|
| String::FlatContent flat2 = string2->GetFlatContent();
|
| - base::SmartArrayPointer<uc16> sap1;
|
| - base::SmartArrayPointer<uc16> sap2;
|
| + std::unique_ptr<uc16[]> sap1;
|
| + std::unique_ptr<uc16[]> sap2;
|
| const UChar* string_val1 = GetUCharBufferFromFlat(flat1, &sap1, length1);
|
| const UChar* string_val2 = GetUCharBufferFromFlat(flat2, &sap2, length2);
|
| result =
|
| @@ -613,7 +615,7 @@ RUNTIME_FUNCTION(Runtime_StringNormalize) {
|
| int length = s->length();
|
| s = String::Flatten(s);
|
| icu::UnicodeString result;
|
| - base::SmartArrayPointer<uc16> sap;
|
| + std::unique_ptr<uc16[]> sap;
|
| UErrorCode status = U_ZERO_ERROR;
|
| {
|
| DisallowHeapAllocation no_gc;
|
| @@ -712,7 +714,7 @@ RUNTIME_FUNCTION(Runtime_BreakIteratorAdoptText) {
|
| text = String::Flatten(text);
|
| DisallowHeapAllocation no_gc;
|
| String::FlatContent flat = text->GetFlatContent();
|
| - base::SmartArrayPointer<uc16> sap;
|
| + std::unique_ptr<uc16[]> sap;
|
| const UChar* text_value = GetUCharBufferFromFlat(flat, &sap, length);
|
| u_text = new icu::UnicodeString(text_value, length);
|
| break_iterator_holder->SetInternalField(1, reinterpret_cast<Smi*>(u_text));
|
| @@ -824,7 +826,7 @@ MUST_USE_RESULT Object* LocaleConvertCase(Handle<String> s, Isolate* isolate,
|
| // ICU's C API for transliteration is nasty and we just use C++ API.
|
| if (V8_UNLIKELY(is_to_upper && lang[0] == 'e' && lang[1] == 'l')) {
|
| icu::UnicodeString converted;
|
| - base::SmartArrayPointer<uc16> sap;
|
| + std::unique_ptr<uc16[]> sap;
|
| {
|
| DisallowHeapAllocation no_gc;
|
| String::FlatContent flat = s->GetFlatContent();
|
| @@ -852,7 +854,7 @@ MUST_USE_RESULT Object* LocaleConvertCase(Handle<String> s, Isolate* isolate,
|
| int32_t dest_length = src_length;
|
| UErrorCode status;
|
| Handle<SeqTwoByteString> result;
|
| - base::SmartArrayPointer<uc16> sap;
|
| + std::unique_ptr<uc16[]> sap;
|
|
|
| // This is not a real loop. It'll be executed only once (no overflow) or
|
| // twice (overflow).
|
|
|