| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 } | 330 } |
| 331 | 331 |
| 332 | 332 |
| 333 function ObjectKeys(obj) { | 333 function ObjectKeys(obj) { |
| 334 if (!IS_SPEC_OBJECT(obj)) { | 334 if (!IS_SPEC_OBJECT(obj)) { |
| 335 throw MakeTypeError("called_on_non_object", ["Object.keys"]); | 335 throw MakeTypeError("called_on_non_object", ["Object.keys"]); |
| 336 } | 336 } |
| 337 if (%IsJSProxy(obj)) { | 337 if (%IsJSProxy(obj)) { |
| 338 var handler = %GetHandler(obj); | 338 var handler = %GetHandler(obj); |
| 339 var names = CallTrap0(handler, "keys", DerivedKeysTrap); | 339 var names = CallTrap0(handler, "keys", DerivedKeysTrap); |
| 340 return ToStringArray(names); | 340 return ToStringArray(names, "keys"); |
| 341 } | 341 } |
| 342 return %LocalKeys(obj); | 342 return %LocalKeys(obj); |
| 343 } | 343 } |
| 344 | 344 |
| 345 | 345 |
| 346 // ES5 8.10.1. | 346 // ES5 8.10.1. |
| 347 function IsAccessorDescriptor(desc) { | 347 function IsAccessorDescriptor(desc) { |
| 348 if (IS_UNDEFINED(desc)) return false; | 348 if (IS_UNDEFINED(desc)) return false; |
| 349 return desc.hasGetter() || desc.hasSetter(); | 349 return desc.hasGetter() || desc.hasSetter(); |
| 350 } | 350 } |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 // For Harmony proxies | 956 // For Harmony proxies |
| 957 function ToStringArray(obj, trap) { | 957 function ToStringArray(obj, trap) { |
| 958 if (!IS_SPEC_OBJECT(obj)) { | 958 if (!IS_SPEC_OBJECT(obj)) { |
| 959 throw MakeTypeError("proxy_non_object_prop_names", [obj, trap]); | 959 throw MakeTypeError("proxy_non_object_prop_names", [obj, trap]); |
| 960 } | 960 } |
| 961 var n = ToUint32(obj.length); | 961 var n = ToUint32(obj.length); |
| 962 var array = new $Array(n); | 962 var array = new $Array(n); |
| 963 var names = {}; // TODO(rossberg): use sets once they are ready. | 963 var names = {}; // TODO(rossberg): use sets once they are ready. |
| 964 for (var index = 0; index < n; index++) { | 964 for (var index = 0; index < n; index++) { |
| 965 var s = ToString(obj[index]); | 965 var s = ToString(obj[index]); |
| 966 if (s in names) { | 966 if (%HasLocalProperty(names, s)) { |
| 967 throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]); | 967 throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]); |
| 968 } | 968 } |
| 969 array[index] = s; | 969 array[index] = s; |
| 970 names[s] = 0; | 970 names[s] = 0; |
| 971 } | 971 } |
| 972 return array; | 972 return array; |
| 973 } | 973 } |
| 974 | 974 |
| 975 | 975 |
| 976 // ES5 section 15.2.3.4. | 976 // ES5 section 15.2.3.4. |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 | 1665 |
| 1666 function SetUpFunction() { | 1666 function SetUpFunction() { |
| 1667 %CheckIsBootstrapping(); | 1667 %CheckIsBootstrapping(); |
| 1668 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1668 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
| 1669 "bind", FunctionBind, | 1669 "bind", FunctionBind, |
| 1670 "toString", FunctionToString | 1670 "toString", FunctionToString |
| 1671 )); | 1671 )); |
| 1672 } | 1672 } |
| 1673 | 1673 |
| 1674 SetUpFunction(); | 1674 SetUpFunction(); |
| OLD | NEW |