OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 // ECMAScript 402 API implementation. | 5 // ECMAScript 402 API implementation. |
6 | 6 |
7 /** | 7 /** |
8 * Intl object is a single object that has some named properties, | 8 * Intl object is a single object that has some named properties, |
9 * all of which are constructors. | 9 * all of which are constructors. |
10 */ | 10 */ |
(...skipping 18 matching lines...) Loading... |
29 var GlobalNumber = global.Number; | 29 var GlobalNumber = global.Number; |
30 var GlobalRegExp = global.RegExp; | 30 var GlobalRegExp = global.RegExp; |
31 var GlobalString = global.String; | 31 var GlobalString = global.String; |
32 var MakeError; | 32 var MakeError; |
33 var MakeRangeError; | 33 var MakeRangeError; |
34 var MakeTypeError; | 34 var MakeTypeError; |
35 var MathFloor; | 35 var MathFloor; |
36 var ObjectDefineProperties = utils.ImportNow("ObjectDefineProperties"); | 36 var ObjectDefineProperties = utils.ImportNow("ObjectDefineProperties"); |
37 var ObjectDefineProperty = utils.ImportNow("ObjectDefineProperty"); | 37 var ObjectDefineProperty = utils.ImportNow("ObjectDefineProperty"); |
38 var ObjectHasOwnProperty = utils.ImportNow("ObjectHasOwnProperty"); | 38 var ObjectHasOwnProperty = utils.ImportNow("ObjectHasOwnProperty"); |
| 39 var OverrideFunction = utils.OverrideFunction; |
39 var patternSymbol = utils.ImportNow("intl_pattern_symbol"); | 40 var patternSymbol = utils.ImportNow("intl_pattern_symbol"); |
40 var RegExpTest; | 41 var RegExpTest; |
41 var resolvedSymbol = utils.ImportNow("intl_resolved_symbol"); | 42 var resolvedSymbol = utils.ImportNow("intl_resolved_symbol"); |
42 var SetFunctionName = utils.SetFunctionName; | 43 var SetFunctionName = utils.SetFunctionName; |
43 var StringIndexOf; | 44 var StringIndexOf; |
44 var StringLastIndexOf; | 45 var StringLastIndexOf; |
45 var StringMatch; | 46 var StringMatch; |
46 var StringReplace; | 47 var StringReplace; |
47 var StringSplit; | 48 var StringSplit; |
48 var StringSubstr; | 49 var StringSubstr; |
(...skipping 14 matching lines...) Loading... |
63 StringLastIndexOf = from.StringLastIndexOf; | 64 StringLastIndexOf = from.StringLastIndexOf; |
64 StringMatch = from.StringMatch; | 65 StringMatch = from.StringMatch; |
65 StringReplace = from.StringReplace; | 66 StringReplace = from.StringReplace; |
66 StringSplit = from.StringSplit; | 67 StringSplit = from.StringSplit; |
67 StringSubstr = from.StringSubstr; | 68 StringSubstr = from.StringSubstr; |
68 StringSubstring = from.StringSubstring; | 69 StringSubstring = from.StringSubstring; |
69 }); | 70 }); |
70 | 71 |
71 // Utilities for definitions | 72 // Utilities for definitions |
72 | 73 |
73 function OverrideFunction(object, name, f) { | |
74 %CheckIsBootstrapping(); | |
75 ObjectDefineProperty(object, name, { value: f, | |
76 writeable: true, | |
77 configurable: true, | |
78 enumerable: false }); | |
79 %FunctionSetName(f, name); | |
80 %FunctionRemovePrototype(f); | |
81 %SetNativeFlag(f); | |
82 } | |
83 | |
84 function InstallFunction(object, name, func) { | 74 function InstallFunction(object, name, func) { |
85 InstallFunctions(object, DONT_ENUM, [name, func]); | 75 InstallFunctions(object, DONT_ENUM, [name, func]); |
86 } | 76 } |
87 | 77 |
88 | 78 |
89 function InstallConstructor(object, name, func) { | 79 function InstallConstructor(object, name, func) { |
90 %CheckIsBootstrapping(); | 80 %CheckIsBootstrapping(); |
91 SetFunctionName(func, name); | 81 SetFunctionName(func, name); |
92 %AddNamedProperty(object, name, func, DONT_ENUM); | 82 %AddNamedProperty(object, name, func, DONT_ENUM); |
93 %SetNativeFlag(func); | 83 %SetNativeFlag(func); |
(...skipping 2054 matching lines...) Loading... |
2148 } | 2138 } |
2149 | 2139 |
2150 var locales = arguments[0]; | 2140 var locales = arguments[0]; |
2151 var options = arguments[1]; | 2141 var options = arguments[1]; |
2152 return toLocaleDateTime( | 2142 return toLocaleDateTime( |
2153 this, locales, options, 'time', 'time', 'dateformattime'); | 2143 this, locales, options, 'time', 'time', 'dateformattime'); |
2154 } | 2144 } |
2155 ); | 2145 ); |
2156 | 2146 |
2157 }) | 2147 }) |
OLD | NEW |