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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 // generating two change records. | 921 // generating two change records. |
922 obj.length = new_length; | 922 obj.length = new_length; |
923 desc.value_ = void 0; | 923 desc.value_ = void 0; |
924 desc.hasValue_ = false; | 924 desc.hasValue_ = false; |
925 threw = !DefineObjectProperty(obj, "length", desc, should_throw) || threw; | 925 threw = !DefineObjectProperty(obj, "length", desc, should_throw) || threw; |
926 if (emit_splice) { | 926 if (emit_splice) { |
927 EndPerformSplice(obj); | 927 EndPerformSplice(obj); |
928 EnqueueSpliceRecord(obj, | 928 EnqueueSpliceRecord(obj, |
929 new_length < old_length ? new_length : old_length, | 929 new_length < old_length ? new_length : old_length, |
930 removed, | 930 removed, |
931 removed.length, | |
932 new_length > old_length ? new_length - old_length : 0); | 931 new_length > old_length ? new_length - old_length : 0); |
933 } | 932 } |
934 if (threw) { | 933 if (threw) { |
935 if (should_throw) { | 934 if (should_throw) { |
936 throw MakeTypeError("redefine_disallowed", [p]); | 935 throw MakeTypeError("redefine_disallowed", [p]); |
937 } else { | 936 } else { |
938 return false; | 937 return false; |
939 } | 938 } |
940 } | 939 } |
941 return true; | 940 return true; |
(...skipping 18 matching lines...) Expand all Loading... |
960 throw MakeTypeError("define_disallowed", [p]); | 959 throw MakeTypeError("define_disallowed", [p]); |
961 } else { | 960 } else { |
962 return false; | 961 return false; |
963 } | 962 } |
964 } | 963 } |
965 if (index >= length) { | 964 if (index >= length) { |
966 obj.length = index + 1; | 965 obj.length = index + 1; |
967 } | 966 } |
968 if (emit_splice) { | 967 if (emit_splice) { |
969 EndPerformSplice(obj); | 968 EndPerformSplice(obj); |
970 EnqueueSpliceRecord(obj, length, [], 0, index + 1 - length); | 969 EnqueueSpliceRecord(obj, length, [], index + 1 - length); |
971 } | 970 } |
972 return true; | 971 return true; |
973 } | 972 } |
974 | 973 |
975 // Step 5 - Fallback to default implementation. | 974 // Step 5 - Fallback to default implementation. |
976 return DefineObjectProperty(obj, p, desc, should_throw); | 975 return DefineObjectProperty(obj, p, desc, should_throw); |
977 } | 976 } |
978 | 977 |
979 | 978 |
980 // ES5 section 8.12.9, ES5 section 15.4.5.1 and Harmony proxies. | 979 // ES5 section 8.12.9, ES5 section 15.4.5.1 and Harmony proxies. |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 %SetCode($Function, NewFunction); | 1823 %SetCode($Function, NewFunction); |
1825 %SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM); | 1824 %SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM); |
1826 | 1825 |
1827 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1826 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1828 "bind", FunctionBind, | 1827 "bind", FunctionBind, |
1829 "toString", FunctionToString | 1828 "toString", FunctionToString |
1830 )); | 1829 )); |
1831 } | 1830 } |
1832 | 1831 |
1833 SetUpFunction(); | 1832 SetUpFunction(); |
OLD | NEW |