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

Side by Side Diff: src/runtime/runtime-i18n.cc

Issue 1775973002: Add GetProperty/GetElement to JSReceiver and use it where possible (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/runtime/runtime-liveedit.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 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
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
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
OLDNEW
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/runtime/runtime-liveedit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698