| 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/runtime/runtime-utils.h" | 7 #include "src/runtime/runtime-utils.h" |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/api-natives.h" | 10 #include "src/api-natives.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 uint32_t length = static_cast<uint32_t>(input->length()->Number()); | 152 uint32_t length = static_cast<uint32_t>(input->length()->Number()); |
| 153 // Set some limit to prevent fuzz tests from going OOM. | 153 // Set some limit to prevent fuzz tests from going OOM. |
| 154 // Can be bumped when callers' requirements change. | 154 // Can be bumped when callers' requirements change. |
| 155 RUNTIME_ASSERT(length < 100); | 155 RUNTIME_ASSERT(length < 100); |
| 156 Handle<FixedArray> output = factory->NewFixedArray(length); | 156 Handle<FixedArray> output = factory->NewFixedArray(length); |
| 157 Handle<Name> maximized = factory->NewStringFromStaticChars("maximized"); | 157 Handle<Name> maximized = factory->NewStringFromStaticChars("maximized"); |
| 158 Handle<Name> base = factory->NewStringFromStaticChars("base"); | 158 Handle<Name> base = factory->NewStringFromStaticChars("base"); |
| 159 for (unsigned int i = 0; i < length; ++i) { | 159 for (unsigned int i = 0; i < length; ++i) { |
| 160 Handle<Object> locale_id; | 160 Handle<Object> locale_id; |
| 161 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, locale_id, | 161 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 162 Object::GetElement(isolate, input, i)); | 162 isolate, locale_id, JSReceiver::GetElement(isolate, input, i)); |
| 163 if (!locale_id->IsString()) { | 163 if (!locale_id->IsString()) { |
| 164 return isolate->Throw(*factory->illegal_argument_string()); | 164 return isolate->Throw(*factory->illegal_argument_string()); |
| 165 } | 165 } |
| 166 | 166 |
| 167 v8::String::Utf8Value utf8_locale_id( | 167 v8::String::Utf8Value utf8_locale_id( |
| 168 v8::Utils::ToLocal(Handle<String>::cast(locale_id))); | 168 v8::Utils::ToLocal(Handle<String>::cast(locale_id))); |
| 169 | 169 |
| 170 UErrorCode error = U_ZERO_ERROR; | 170 UErrorCode error = U_ZERO_ERROR; |
| 171 | 171 |
| 172 // Convert from BCP47 to ICU format. | 172 // Convert from BCP47 to ICU format. |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) { | 746 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) { |
| 747 return *isolate->factory()->NewStringFromStaticChars("ideo"); | 747 return *isolate->factory()->NewStringFromStaticChars("ideo"); |
| 748 } else { | 748 } else { |
| 749 return *isolate->factory()->NewStringFromStaticChars("unknown"); | 749 return *isolate->factory()->NewStringFromStaticChars("unknown"); |
| 750 } | 750 } |
| 751 } | 751 } |
| 752 } // namespace internal | 752 } // namespace internal |
| 753 } // namespace v8 | 753 } // namespace v8 |
| 754 | 754 |
| 755 #endif // V8_I18N_SUPPORT | 755 #endif // V8_I18N_SUPPORT |
| OLD | NEW |