OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
877 } | 877 } |
878 | 878 |
879 | 879 |
880 // For Harmony proxies | 880 // For Harmony proxies |
881 function ToStringArray(obj, trap) { | 881 function ToStringArray(obj, trap) { |
882 if (!IS_SPEC_OBJECT(obj)) { | 882 if (!IS_SPEC_OBJECT(obj)) { |
883 throw MakeTypeError("proxy_non_object_prop_names", [obj, trap]); | 883 throw MakeTypeError("proxy_non_object_prop_names", [obj, trap]); |
884 } | 884 } |
885 var n = ToUint32(obj.length); | 885 var n = ToUint32(obj.length); |
886 var array = new $Array(n); | 886 var array = new $Array(n); |
887 var names = {} | 887 var names = {} // TODO(rossberg): use sets once they are ready. |
Rico
2011/10/20 14:25:31
Please file bug
| |
888 for (var index = 0; index < n; index++) { | 888 for (var index = 0; index < n; index++) { |
889 var s = ToString(obj[index]); | 889 var s = ToString(obj[index]); |
890 if (s in names) { | 890 if (s in names) { |
891 throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]) | 891 throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]) |
892 } | 892 } |
893 array[index] = s; | 893 array[index] = s; |
894 names.s = 0; | 894 names[s] = 0; |
895 } | 895 } |
896 return array; | 896 return array; |
897 } | 897 } |
898 | 898 |
899 | 899 |
900 // ES5 section 15.2.3.4. | 900 // ES5 section 15.2.3.4. |
901 function ObjectGetOwnPropertyNames(obj) { | 901 function ObjectGetOwnPropertyNames(obj) { |
902 if (!IS_SPEC_OBJECT(obj)) | 902 if (!IS_SPEC_OBJECT(obj)) |
903 throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyNames"]) ; | 903 throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyNames"]) ; |
904 | 904 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1003 */ | 1003 */ |
1004 } else { | 1004 } else { |
1005 var desc = ToPropertyDescriptor(attributes); | 1005 var desc = ToPropertyDescriptor(attributes); |
1006 DefineOwnProperty(obj, name, desc, true); | 1006 DefineOwnProperty(obj, name, desc, true); |
1007 } | 1007 } |
1008 return obj; | 1008 return obj; |
1009 } | 1009 } |
1010 | 1010 |
1011 | 1011 |
1012 function GetOwnEnumerablePropertyNames(properties) { | 1012 function GetOwnEnumerablePropertyNames(properties) { |
1013 global.print("GetOwnEnumerablePropertyNames"); | |
Rico
2011/10/20 14:25:31
Debug print?
rossberg
2011/10/24 13:31:35
Oops.
| |
1013 var names = new InternalArray(); | 1014 var names = new InternalArray(); |
1014 for (var key in properties) { | 1015 for (var key in properties) { |
1015 if (%HasLocalProperty(properties, key)) { | 1016 if (%HasLocalProperty(properties, key)) { |
1016 names.push(key); | 1017 names.push(key); |
1017 } | 1018 } |
1018 } | 1019 } |
1019 return names; | 1020 return names; |
1020 } | 1021 } |
1021 | 1022 |
1022 | 1023 |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1562 | 1563 |
1563 function SetUpFunction() { | 1564 function SetUpFunction() { |
1564 %CheckIsBootstrapping(); | 1565 %CheckIsBootstrapping(); |
1565 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1566 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1566 "bind", FunctionBind, | 1567 "bind", FunctionBind, |
1567 "toString", FunctionToString | 1568 "toString", FunctionToString |
1568 )); | 1569 )); |
1569 } | 1570 } |
1570 | 1571 |
1571 SetUpFunction(); | 1572 SetUpFunction(); |
OLD | NEW |