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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 | 134 |
135 function NAMEConstructByIterable(obj, iterable, iteratorFn) { | 135 function NAMEConstructByIterable(obj, iterable, iteratorFn) { |
136 var list = new InternalArray(); | 136 var list = new InternalArray(); |
137 // Reading the Symbol.iterator property of iterable twice would be | 137 // Reading the Symbol.iterator property of iterable twice would be |
138 // observable with getters, so instead, we call the function which | 138 // observable with getters, so instead, we call the function which |
139 // was already looked up, and wrap it in another iterable. The | 139 // was already looked up, and wrap it in another iterable. The |
140 // __proto__ of the new iterable is set to null to avoid any chance | 140 // __proto__ of the new iterable is set to null to avoid any chance |
141 // of modifications to Object.prototype being observable here. | 141 // of modifications to Object.prototype being observable here. |
142 var iterator = %_CallFunction(iterable, iteratorFn); | 142 var iterator = %_CallFunction(iterable, iteratorFn); |
143 var newIterable = { | 143 var newIterable = { |
144 __proto__: null, | 144 __proto__: null |
145 [symbolIterator]() { return iterator; } | |
146 }; | 145 }; |
146 // TODO(littledan): Computed properties don't work yet in nosnap. | |
147 // Rephrase when they do. | |
arv (Not doing code reviews)
2015/06/16 16:41:04
I guess we cannot use shipping features until the
| |
148 newIterable[symbolIterator] = function() { return iterator; } | |
147 for (var value of newIterable) { | 149 for (var value of newIterable) { |
148 list.push(value); | 150 list.push(value); |
149 } | 151 } |
150 NAMEConstructByArrayLike(obj, list); | 152 NAMEConstructByArrayLike(obj, list); |
151 } | 153 } |
152 | 154 |
153 function NAMEConstructor(arg1, arg2, arg3) { | 155 function NAMEConstructor(arg1, arg2, arg3) { |
154 if (%_IsConstructCall()) { | 156 if (%_IsConstructCall()) { |
155 if (IS_ARRAYBUFFER(arg1) || IS_SHAREDARRAYBUFFER(arg1)) { | 157 if (IS_ARRAYBUFFER(arg1) || IS_SHAREDARRAYBUFFER(arg1)) { |
156 NAMEConstructByArrayBuffer(this, arg1, arg2, arg3); | 158 NAMEConstructByArrayBuffer(this, arg1, arg2, arg3); |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
498 "setUint32", DataViewSetUint32JS, | 500 "setUint32", DataViewSetUint32JS, |
499 | 501 |
500 "getFloat32", DataViewGetFloat32JS, | 502 "getFloat32", DataViewGetFloat32JS, |
501 "setFloat32", DataViewSetFloat32JS, | 503 "setFloat32", DataViewSetFloat32JS, |
502 | 504 |
503 "getFloat64", DataViewGetFloat64JS, | 505 "getFloat64", DataViewGetFloat64JS, |
504 "setFloat64", DataViewSetFloat64JS | 506 "setFloat64", DataViewSetFloat64JS |
505 ]); | 507 ]); |
506 | 508 |
507 }) | 509 }) |
OLD | NEW |