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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 | 7 |
8 // This file relies on the fact that the following declaration has been made | 8 // This file relies on the fact that the following declaration has been made |
9 // in runtime.js: | 9 // in runtime.js: |
10 // var $Array = global.Array; | 10 // var $Array = global.Array; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // 22.1.5.2.2 %ArrayIteratorPrototype%[@@iterator] | 43 // 22.1.5.2.2 %ArrayIteratorPrototype%[@@iterator] |
44 function ArrayIteratorIterator() { | 44 function ArrayIteratorIterator() { |
45 return this; | 45 return this; |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 // 15.4.5.2.2 ArrayIterator.prototype.next( ) | 49 // 15.4.5.2.2 ArrayIterator.prototype.next( ) |
50 function ArrayIteratorNext() { | 50 function ArrayIteratorNext() { |
51 var iterator = ToObject(this); | 51 var iterator = ToObject(this); |
52 | 52 |
53 if (!HAS_PRIVATE(iterator, arrayIteratorObjectSymbol)) { | 53 if (!HAS_DEFINED_PRIVATE(iterator, arrayIteratorNextIndexSymbol)) { |
54 throw MakeTypeError('incompatible_method_receiver', | 54 throw MakeTypeError('incompatible_method_receiver', |
55 ['Array Iterator.prototype.next']); | 55 ['Array Iterator.prototype.next']); |
56 } | 56 } |
57 | 57 |
58 var array = GET_PRIVATE(iterator, arrayIteratorObjectSymbol); | 58 var array = GET_PRIVATE(iterator, arrayIteratorObjectSymbol); |
59 if (IS_UNDEFINED(array)) { | 59 if (IS_UNDEFINED(array)) { |
60 return CreateIteratorResultObject(UNDEFINED, true); | 60 return CreateIteratorResultObject(UNDEFINED, true); |
61 } | 61 } |
62 | 62 |
63 var index = GET_PRIVATE(iterator, arrayIteratorNextIndexSymbol); | 63 var index = GET_PRIVATE(iterator, arrayIteratorNextIndexSymbol); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 macro EXTEND_TYPED_ARRAY(NAME) | 148 macro EXTEND_TYPED_ARRAY(NAME) |
149 %AddNamedProperty($NAME.prototype, 'entries', ArrayEntries, DONT_ENUM); | 149 %AddNamedProperty($NAME.prototype, 'entries', ArrayEntries, DONT_ENUM); |
150 %AddNamedProperty($NAME.prototype, 'values', ArrayValues, DONT_ENUM); | 150 %AddNamedProperty($NAME.prototype, 'values', ArrayValues, DONT_ENUM); |
151 %AddNamedProperty($NAME.prototype, 'keys', ArrayKeys, DONT_ENUM); | 151 %AddNamedProperty($NAME.prototype, 'keys', ArrayKeys, DONT_ENUM); |
152 %AddNamedProperty($NAME.prototype, symbolIterator, ArrayValues, DONT_ENUM); | 152 %AddNamedProperty($NAME.prototype, symbolIterator, ArrayValues, DONT_ENUM); |
153 endmacro | 153 endmacro |
154 | 154 |
155 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) | 155 TYPED_ARRAYS(EXTEND_TYPED_ARRAY) |
156 } | 156 } |
157 ExtendTypedArrayPrototypes(); | 157 ExtendTypedArrayPrototypes(); |
OLD | NEW |