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 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 function NAMEConstructByIterable(obj, iterable, iteratorFn) { | 139 function NAMEConstructByIterable(obj, iterable, iteratorFn) { |
140 var list = new InternalArray(); | 140 var list = new InternalArray(); |
141 // Reading the Symbol.iterator property of iterable twice would be | 141 // Reading the Symbol.iterator property of iterable twice would be |
142 // observable with getters, so instead, we call the function which | 142 // observable with getters, so instead, we call the function which |
143 // was already looked up, and wrap it in another iterable. The | 143 // was already looked up, and wrap it in another iterable. The |
144 // __proto__ of the new iterable is set to null to avoid any chance | 144 // __proto__ of the new iterable is set to null to avoid any chance |
145 // of modifications to Object.prototype being observable here. | 145 // of modifications to Object.prototype being observable here. |
146 var iterator = %_CallFunction(iterable, iteratorFn); | 146 var iterator = %_Call(iteratorFn, iterable); |
147 var newIterable = { | 147 var newIterable = { |
148 __proto__: null | 148 __proto__: null |
149 }; | 149 }; |
150 // TODO(littledan): Computed properties don't work yet in nosnap. | 150 // TODO(littledan): Computed properties don't work yet in nosnap. |
151 // Rephrase when they do. | 151 // Rephrase when they do. |
152 newIterable[iteratorSymbol] = function() { return iterator; } | 152 newIterable[iteratorSymbol] = function() { return iterator; } |
153 for (var value of newIterable) { | 153 for (var value of newIterable) { |
154 list.push(value); | 154 list.push(value); |
155 } | 155 } |
156 NAMEConstructByArrayLike(obj, list); | 156 NAMEConstructByArrayLike(obj, list); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 "setUint32", DataViewSetUint32JS, | 505 "setUint32", DataViewSetUint32JS, |
506 | 506 |
507 "getFloat32", DataViewGetFloat32JS, | 507 "getFloat32", DataViewGetFloat32JS, |
508 "setFloat32", DataViewSetFloat32JS, | 508 "setFloat32", DataViewSetFloat32JS, |
509 | 509 |
510 "getFloat64", DataViewGetFloat64JS, | 510 "getFloat64", DataViewGetFloat64JS, |
511 "setFloat64", DataViewSetFloat64JS | 511 "setFloat64", DataViewSetFloat64JS |
512 ]); | 512 ]); |
513 | 513 |
514 }) | 514 }) |
OLD | NEW |