Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(855)

Side by Side Diff: src/v8natives.js

Issue 856303002: Don't take iterable path in ArrayFrom if items[@@iterator] is null (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cleanup test Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/harmony-array.js ('k') | test/mjsunit/harmony/array-from.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 %DeleteProperty(obj, p, 0); 647 %DeleteProperty(obj, p, 0);
648 return true; 648 return true;
649 } else if (should_throw) { 649 } else if (should_throw) {
650 throw MakeTypeError("define_disallowed", [p]); 650 throw MakeTypeError("define_disallowed", [p]);
651 } else { 651 } else {
652 return; 652 return;
653 } 653 }
654 } 654 }
655 655
656 656
657 // ES6, draft 12-24-14, section 7.3.8
658 function GetMethod(obj, p) {
659 var func = obj[p];
660 if (IS_NULL_OR_UNDEFINED(func)) return UNDEFINED;
661 if (IS_SPEC_FUNCTION(func)) return func;
662 throw MakeTypeError('called_non_callable', [typeof func]);
663 }
664
665
657 // Harmony proxies. 666 // Harmony proxies.
658 function DefineProxyProperty(obj, p, attributes, should_throw) { 667 function DefineProxyProperty(obj, p, attributes, should_throw) {
659 // TODO(rossberg): adjust once there is a story for symbols vs proxies. 668 // TODO(rossberg): adjust once there is a story for symbols vs proxies.
660 if (IS_SYMBOL(p)) return false; 669 if (IS_SYMBOL(p)) return false;
661 670
662 var handler = %GetHandler(obj); 671 var handler = %GetHandler(obj);
663 var result = CallTrap2(handler, "defineProperty", UNDEFINED, p, attributes); 672 var result = CallTrap2(handler, "defineProperty", UNDEFINED, p, attributes);
664 if (!ToBoolean(result)) { 673 if (!ToBoolean(result)) {
665 if (should_throw) { 674 if (should_throw) {
666 throw MakeTypeError("handler_returned_false", 675 throw MakeTypeError("handler_returned_false",
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 } 1897 }
1889 if (!IS_SPEC_FUNCTION(method)) { 1898 if (!IS_SPEC_FUNCTION(method)) {
1890 throw MakeTypeError('not_iterable', [obj]); 1899 throw MakeTypeError('not_iterable', [obj]);
1891 } 1900 }
1892 var iterator = %_CallFunction(obj, method); 1901 var iterator = %_CallFunction(obj, method);
1893 if (!IS_SPEC_OBJECT(iterator)) { 1902 if (!IS_SPEC_OBJECT(iterator)) {
1894 throw MakeTypeError('not_an_iterator', [iterator]); 1903 throw MakeTypeError('not_an_iterator', [iterator]);
1895 } 1904 }
1896 return iterator; 1905 return iterator;
1897 } 1906 }
OLDNEW
« no previous file with comments | « src/harmony-array.js ('k') | test/mjsunit/harmony/array-from.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698