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 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 } | 930 } |
931 | 931 |
932 | 932 |
933 // For Harmony proxies | 933 // For Harmony proxies |
934 function ToStringArray(obj, trap) { | 934 function ToStringArray(obj, trap) { |
935 if (!IS_SPEC_OBJECT(obj)) { | 935 if (!IS_SPEC_OBJECT(obj)) { |
936 throw MakeTypeError("proxy_non_object_prop_names", [obj, trap]); | 936 throw MakeTypeError("proxy_non_object_prop_names", [obj, trap]); |
937 } | 937 } |
938 var n = ToUint32(obj.length); | 938 var n = ToUint32(obj.length); |
939 var array = new $Array(n); | 939 var array = new $Array(n); |
940 var names = {} | 940 var names = {} // TODO(rossberg): use sets once they are ready. |
941 for (var index = 0; index < n; index++) { | 941 for (var index = 0; index < n; index++) { |
942 var s = ToString(obj[index]); | 942 var s = ToString(obj[index]); |
943 if (s in names) { | 943 if (s in names) { |
944 throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]) | 944 throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]) |
945 } | 945 } |
946 array[index] = s; | 946 array[index] = s; |
947 names.s = 0; | 947 names[s] = 0; |
948 } | 948 } |
949 return array; | 949 return array; |
950 } | 950 } |
951 | 951 |
952 | 952 |
953 // ES5 section 15.2.3.4. | 953 // ES5 section 15.2.3.4. |
954 function ObjectGetOwnPropertyNames(obj) { | 954 function ObjectGetOwnPropertyNames(obj) { |
955 if (!IS_SPEC_OBJECT(obj)) | 955 if (!IS_SPEC_OBJECT(obj)) |
956 throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyNames"])
; | 956 throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyNames"])
; |
957 | 957 |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 | 1607 |
1608 function SetUpFunction() { | 1608 function SetUpFunction() { |
1609 %CheckIsBootstrapping(); | 1609 %CheckIsBootstrapping(); |
1610 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1610 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1611 "bind", FunctionBind, | 1611 "bind", FunctionBind, |
1612 "toString", FunctionToString | 1612 "toString", FunctionToString |
1613 )); | 1613 )); |
1614 } | 1614 } |
1615 | 1615 |
1616 SetUpFunction(); | 1616 SetUpFunction(); |
OLD | NEW |