OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 // This file relies on the fact that the following declarations have been made | 5 // This file relies on the fact that the following declarations have been made |
6 // in runtime.js: | 6 // in runtime.js: |
7 // var $Object = global.Object; | 7 // var $Object = global.Object; |
8 // var $Boolean = global.Boolean; | 8 // var $Boolean = global.Boolean; |
9 // var $Number = global.Number; | 9 // var $Number = global.Number; |
10 // var $Function = global.Function; | 10 // var $Function = global.Function; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 "eval", GlobalEval | 209 "eval", GlobalEval |
210 )); | 210 )); |
211 } | 211 } |
212 | 212 |
213 SetUpGlobal(); | 213 SetUpGlobal(); |
214 | 214 |
215 | 215 |
216 // ---------------------------------------------------------------------------- | 216 // ---------------------------------------------------------------------------- |
217 // Object | 217 // Object |
218 | 218 |
219 var DefaultObjectToString = ObjectToString; | |
220 // ECMA-262 - 15.2.4.2 | 219 // ECMA-262 - 15.2.4.2 |
221 function NoSideEffectsObjectToString() { | 220 function NoSideEffectsObjectToString() { |
222 if (IS_UNDEFINED(this) && !IS_UNDETECTABLE(this)) return "[object Undefined]"; | 221 if (IS_UNDEFINED(this) && !IS_UNDETECTABLE(this)) return "[object Undefined]"; |
223 if (IS_NULL(this)) return "[object Null]"; | 222 if (IS_NULL(this)) return "[object Null]"; |
224 return "[object " + %_ClassOf(TO_OBJECT_INLINE(this)) + "]"; | 223 return "[object " + %_ClassOf(TO_OBJECT_INLINE(this)) + "]"; |
225 } | 224 } |
226 | 225 |
227 | 226 |
228 function ObjectToString() { | 227 function ObjectToString() { |
229 if (IS_UNDEFINED(this) && !IS_UNDETECTABLE(this)) return "[object Undefined]"; | 228 if (IS_UNDEFINED(this) && !IS_UNDETECTABLE(this)) return "[object Undefined]"; |
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 } | 1913 } |
1915 if (!IS_SPEC_FUNCTION(method)) { | 1914 if (!IS_SPEC_FUNCTION(method)) { |
1916 throw MakeTypeError('not_iterable', [obj]); | 1915 throw MakeTypeError('not_iterable', [obj]); |
1917 } | 1916 } |
1918 var iterator = %_CallFunction(obj, method); | 1917 var iterator = %_CallFunction(obj, method); |
1919 if (!IS_SPEC_OBJECT(iterator)) { | 1918 if (!IS_SPEC_OBJECT(iterator)) { |
1920 throw MakeTypeError('not_an_iterator', [iterator]); | 1919 throw MakeTypeError('not_an_iterator', [iterator]); |
1921 } | 1920 } |
1922 return iterator; | 1921 return iterator; |
1923 } | 1922 } |
OLD | NEW |