| 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 "use strict"; | 5 "use strict"; |
| 6 | 6 |
| 7 // This file relies on the fact that the following declaration has been made | 7 // This file relies on the fact that the following declaration has been made |
| 8 // in runtime.js: | 8 // in runtime.js: |
| 9 // var $Array = global.Array; | 9 // var $Array = global.Array; |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 var iter, adder; | 23 var iter, adder; |
| 24 | 24 |
| 25 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 25 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
| 26 iter = GetIterator(ToObject(iterable)); | 26 iter = GetIterator(ToObject(iterable)); |
| 27 adder = this.add; | 27 adder = this.add; |
| 28 if (!IS_SPEC_FUNCTION(adder)) { | 28 if (!IS_SPEC_FUNCTION(adder)) { |
| 29 throw MakeTypeError('property_not_function', ['add', this]); | 29 throw MakeTypeError('property_not_function', ['add', this]); |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 %SetInitialize(this); | 33 %_SetInitialize(this); |
| 34 | 34 |
| 35 if (IS_UNDEFINED(iter)) return; | 35 if (IS_UNDEFINED(iter)) return; |
| 36 | 36 |
| 37 var next, done; | 37 var next, done; |
| 38 while (!(next = iter.next()).done) { | 38 while (!(next = iter.next()).done) { |
| 39 if (!IS_SPEC_OBJECT(next)) { | 39 if (!IS_SPEC_OBJECT(next)) { |
| 40 throw MakeTypeError('iterator_result_not_an_object', [next]); | 40 throw MakeTypeError('iterator_result_not_an_object', [next]); |
| 41 } | 41 } |
| 42 %_CallFunction(this, next.value, adder); | 42 %_CallFunction(this, next.value, adder); |
| 43 } | 43 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 var iter, adder; | 163 var iter, adder; |
| 164 | 164 |
| 165 if (!IS_NULL_OR_UNDEFINED(iterable)) { | 165 if (!IS_NULL_OR_UNDEFINED(iterable)) { |
| 166 iter = GetIterator(ToObject(iterable)); | 166 iter = GetIterator(ToObject(iterable)); |
| 167 adder = this.set; | 167 adder = this.set; |
| 168 if (!IS_SPEC_FUNCTION(adder)) { | 168 if (!IS_SPEC_FUNCTION(adder)) { |
| 169 throw MakeTypeError('property_not_function', ['set', this]); | 169 throw MakeTypeError('property_not_function', ['set', this]); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 %MapInitialize(this); | 173 %_MapInitialize(this); |
| 174 | 174 |
| 175 if (IS_UNDEFINED(iter)) return; | 175 if (IS_UNDEFINED(iter)) return; |
| 176 | 176 |
| 177 var next, done, nextItem; | 177 var next, done, nextItem; |
| 178 while (!(next = iter.next()).done) { | 178 while (!(next = iter.next()).done) { |
| 179 if (!IS_SPEC_OBJECT(next)) { | 179 if (!IS_SPEC_OBJECT(next)) { |
| 180 throw MakeTypeError('iterator_result_not_an_object', [next]); | 180 throw MakeTypeError('iterator_result_not_an_object', [next]); |
| 181 } | 181 } |
| 182 nextItem = next.value; | 182 nextItem = next.value; |
| 183 if (!IS_SPEC_OBJECT(nextItem)) { | 183 if (!IS_SPEC_OBJECT(nextItem)) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 "get", MapGetJS, | 295 "get", MapGetJS, |
| 296 "set", MapSetJS, | 296 "set", MapSetJS, |
| 297 "has", MapHasJS, | 297 "has", MapHasJS, |
| 298 "delete", MapDeleteJS, | 298 "delete", MapDeleteJS, |
| 299 "clear", MapClearJS, | 299 "clear", MapClearJS, |
| 300 "forEach", MapForEach | 300 "forEach", MapForEach |
| 301 )); | 301 )); |
| 302 } | 302 } |
| 303 | 303 |
| 304 SetUpMap(); | 304 SetUpMap(); |
| OLD | NEW |