| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 (!desc.hasValue() || | 556 (!desc.hasValue() || |
| 557 SameValue(desc.getValue(), current.getValue())) && | 557 SameValue(desc.getValue(), current.getValue())) && |
| 558 (!desc.hasGetter() || | 558 (!desc.hasGetter() || |
| 559 SameValue(desc.getGet(), current.getGet())) && | 559 SameValue(desc.getGet(), current.getGet())) && |
| 560 (!desc.hasSetter() || | 560 (!desc.hasSetter() || |
| 561 SameValue(desc.getSet(), current.getSet()))) { | 561 SameValue(desc.getSet(), current.getSet()))) { |
| 562 return true; | 562 return true; |
| 563 } | 563 } |
| 564 | 564 |
| 565 // Step 7 | 565 // Step 7 |
| 566 if (desc.isConfigurable() || desc.isEnumerable() != current.isEnumerable()) | 566 if (desc.isConfigurable() || desc.isEnumerable() != current.isEnumerable()) |
| 567 throw MakeTypeError("redefine_disallowed", ["defineProperty"]); | 567 throw MakeTypeError("redefine_disallowed", ["defineProperty"]); |
| 568 // Step 9 | 568 // Step 9 |
| 569 if (IsDataDescriptor(current) != IsDataDescriptor(desc)) | 569 if (IsDataDescriptor(current) != IsDataDescriptor(desc)) |
| 570 throw MakeTypeError("redefine_disallowed", ["defineProperty"]); | 570 throw MakeTypeError("redefine_disallowed", ["defineProperty"]); |
| 571 // Step 10 | 571 // Step 10 |
| 572 if (IsDataDescriptor(current) && IsDataDescriptor(desc)) { | 572 if (IsDataDescriptor(current) && IsDataDescriptor(desc)) { |
| 573 if (!current.isWritable() && desc.isWritable()) | 573 if (!current.isWritable() && desc.isWritable()) |
| 574 throw MakeTypeError("redefine_disallowed", ["defineProperty"]); | 574 throw MakeTypeError("redefine_disallowed", ["defineProperty"]); |
| 575 if (!current.isWritable() && desc.hasValue() && | 575 if (!current.isWritable() && desc.hasValue() && |
| 576 !SameValue(desc.getValue(), current.getValue())) { | 576 !SameValue(desc.getValue(), current.getValue())) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 flag |= READ_ONLY; | 616 flag |= READ_ONLY; |
| 617 } | 617 } |
| 618 var value = void 0; // Default value is undefined. | 618 var value = void 0; // Default value is undefined. |
| 619 if (desc.hasValue()) { | 619 if (desc.hasValue()) { |
| 620 value = desc.getValue(); | 620 value = desc.getValue(); |
| 621 } else if (!IS_UNDEFINED(current)) { | 621 } else if (!IS_UNDEFINED(current)) { |
| 622 value = current.getValue(); | 622 value = current.getValue(); |
| 623 } | 623 } |
| 624 %DefineOrRedefineDataProperty(obj, p, value, flag); | 624 %DefineOrRedefineDataProperty(obj, p, value, flag); |
| 625 } else { | 625 } else { |
| 626 if (desc.hasGetter() && IS_FUNCTION(desc.getGet())) { | 626 if (desc.hasGetter() && |
| 627 (IS_FUNCTION(desc.getGet()) || IS_UNDEFINED(desc.getGet()))) { |
| 627 %DefineOrRedefineAccessorProperty(obj, p, GETTER, desc.getGet(), flag); | 628 %DefineOrRedefineAccessorProperty(obj, p, GETTER, desc.getGet(), flag); |
| 628 } | 629 } |
| 629 if (desc.hasSetter() && IS_FUNCTION(desc.getSet())) { | 630 if (desc.hasSetter() && |
| 631 (IS_FUNCTION(desc.getSet()) || IS_UNDEFINED(desc.getSet()))) { |
| 630 %DefineOrRedefineAccessorProperty(obj, p, SETTER, desc.getSet(), flag); | 632 %DefineOrRedefineAccessorProperty(obj, p, SETTER, desc.getSet(), flag); |
| 631 } | 633 } |
| 632 } | 634 } |
| 633 return true; | 635 return true; |
| 634 } | 636 } |
| 635 | 637 |
| 636 | 638 |
| 637 // ES5 section 15.2.3.2. | 639 // ES5 section 15.2.3.2. |
| 638 function ObjectGetPrototypeOf(obj) { | 640 function ObjectGetPrototypeOf(obj) { |
| 639 if (!IS_SPEC_OBJECT(obj)) | 641 if (!IS_SPEC_OBJECT(obj)) |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 // ---------------------------------------------------------------------------- | 1175 // ---------------------------------------------------------------------------- |
| 1174 | 1176 |
| 1175 function SetupFunction() { | 1177 function SetupFunction() { |
| 1176 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1178 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
| 1177 "bind", FunctionBind, | 1179 "bind", FunctionBind, |
| 1178 "toString", FunctionToString | 1180 "toString", FunctionToString |
| 1179 )); | 1181 )); |
| 1180 } | 1182 } |
| 1181 | 1183 |
| 1182 SetupFunction(); | 1184 SetupFunction(); |
| OLD | NEW |