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

Side by Side Diff: src/extensions/i18n/break-iterator.js

Issue 18075004: Mark i18n functions as native and set proper names (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « no previous file | src/extensions/i18n/collator.js » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 var locale = getOptimalLanguageTag(segmenter.resolved.requestedLocale, 111 var locale = getOptimalLanguageTag(segmenter.resolved.requestedLocale,
112 segmenter.resolved.locale); 112 segmenter.resolved.locale);
113 113
114 return { 114 return {
115 locale: locale, 115 locale: locale,
116 type: segmenter.resolved.type 116 type: segmenter.resolved.type
117 }; 117 };
118 }, 118 },
119 ATTRIBUTES.DONT_ENUM 119 ATTRIBUTES.DONT_ENUM
120 ); 120 );
121 %FunctionSetName(Intl.v8BreakIterator.prototype.resolvedOptions,
122 'resolvedOptions');
121 %FunctionRemovePrototype(Intl.v8BreakIterator.prototype.resolvedOptions); 123 %FunctionRemovePrototype(Intl.v8BreakIterator.prototype.resolvedOptions);
124 %SetNativeFlag(Intl.v8BreakIterator.prototype.resolvedOptions);
122 125
123 126
124 /** 127 /**
125 * Returns the subset of the given locale list for which this locale list 128 * Returns the subset of the given locale list for which this locale list
126 * has a matching (possibly fallback) locale. Locales appear in the same 129 * has a matching (possibly fallback) locale. Locales appear in the same
127 * order in the returned list as in the input list. 130 * order in the returned list as in the input list.
128 * Options are optional parameter. 131 * Options are optional parameter.
129 */ 132 */
130 %SetProperty(Intl.v8BreakIterator, 'supportedLocalesOf', function(locales) { 133 %SetProperty(Intl.v8BreakIterator, 'supportedLocalesOf', function(locales) {
131 if (%_IsConstructCall()) { 134 if (%_IsConstructCall()) {
132 throw new TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); 135 throw new TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR);
133 } 136 }
134 137
135 return supportedLocalesOf('breakiterator', locales, arguments[1]); 138 return supportedLocalesOf('breakiterator', locales, arguments[1]);
136 }, 139 },
137 ATTRIBUTES.DONT_ENUM 140 ATTRIBUTES.DONT_ENUM
138 ); 141 );
142 %FunctionSetName(Intl.v8BreakIterator.supportedLocalesOf, 'supportedLocalesOf');
139 %FunctionRemovePrototype(Intl.v8BreakIterator.supportedLocalesOf); 143 %FunctionRemovePrototype(Intl.v8BreakIterator.supportedLocalesOf);
144 %SetNativeFlag(Intl.v8BreakIterator.supportedLocalesOf);
140 145
141 146
142 /** 147 /**
143 * Adopts text to segment using the iterator. Old text, if present, 148 * Adopts text to segment using the iterator. Old text, if present,
144 * gets discarded. 149 * gets discarded.
145 */ 150 */
146 function adoptText(iterator, text) { 151 function adoptText(iterator, text) {
147 native function NativeJSBreakIteratorAdoptText(); 152 native function NativeJSBreakIteratorAdoptText();
148 NativeJSBreakIteratorAdoptText(iterator.iterator, String(text)); 153 NativeJSBreakIteratorAdoptText(iterator.iterator, String(text));
149 } 154 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 native function NativeJSBreakIteratorBreakType(); 188 native function NativeJSBreakIteratorBreakType();
184 return NativeJSBreakIteratorBreakType(iterator.iterator); 189 return NativeJSBreakIteratorBreakType(iterator.iterator);
185 } 190 }
186 191
187 192
188 addBoundMethod(Intl.v8BreakIterator, 'adoptText', adoptText, 1); 193 addBoundMethod(Intl.v8BreakIterator, 'adoptText', adoptText, 1);
189 addBoundMethod(Intl.v8BreakIterator, 'first', first, 0); 194 addBoundMethod(Intl.v8BreakIterator, 'first', first, 0);
190 addBoundMethod(Intl.v8BreakIterator, 'next', next, 0); 195 addBoundMethod(Intl.v8BreakIterator, 'next', next, 0);
191 addBoundMethod(Intl.v8BreakIterator, 'current', current, 0); 196 addBoundMethod(Intl.v8BreakIterator, 'current', current, 0);
192 addBoundMethod(Intl.v8BreakIterator, 'breakType', breakType, 0); 197 addBoundMethod(Intl.v8BreakIterator, 'breakType', breakType, 0);
OLDNEW
« no previous file with comments | « no previous file | src/extensions/i18n/collator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698