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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 flag |= DONT_DELETE; | 608 flag |= DONT_DELETE; |
609 | 609 |
610 if (IsDataDescriptor(desc) || IsGenericDescriptor(desc)) { | 610 if (IsDataDescriptor(desc) || IsGenericDescriptor(desc)) { |
611 if (desc.hasWritable()) { | 611 if (desc.hasWritable()) { |
612 flag |= desc.isWritable() ? 0 : READ_ONLY; | 612 flag |= desc.isWritable() ? 0 : READ_ONLY; |
613 } else if (!IS_UNDEFINED(current)) { | 613 } else if (!IS_UNDEFINED(current)) { |
614 flag |= current.isWritable() ? 0 : READ_ONLY; | 614 flag |= current.isWritable() ? 0 : READ_ONLY; |
615 } else { | 615 } else { |
616 flag |= READ_ONLY; | 616 flag |= READ_ONLY; |
617 } | 617 } |
618 var value = void 0; // Default value is undefined. | 618 %DefineOrRedefineDataProperty(obj, p, desc.getValue(), flag); |
619 if (desc.hasValue()) { | |
620 value = desc.getValue(); | |
621 } else if (!IS_UNDEFINED(current)) { | |
622 value = current.getValue(); | |
623 } | |
624 %DefineOrRedefineDataProperty(obj, p, value, flag); | |
625 } else { | 619 } else { |
626 if (desc.hasGetter() && IS_FUNCTION(desc.getGet())) { | 620 if (desc.hasGetter() && IS_FUNCTION(desc.getGet())) { |
627 %DefineOrRedefineAccessorProperty(obj, p, GETTER, desc.getGet(), flag); | 621 %DefineOrRedefineAccessorProperty(obj, p, GETTER, desc.getGet(), flag); |
628 } | 622 } |
629 if (desc.hasSetter() && IS_FUNCTION(desc.getSet())) { | 623 if (desc.hasSetter() && IS_FUNCTION(desc.getSet())) { |
630 %DefineOrRedefineAccessorProperty(obj, p, SETTER, desc.getSet(), flag); | 624 %DefineOrRedefineAccessorProperty(obj, p, SETTER, desc.getSet(), flag); |
631 } | 625 } |
632 } | 626 } |
633 return true; | 627 return true; |
634 } | 628 } |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 // ---------------------------------------------------------------------------- | 1187 // ---------------------------------------------------------------------------- |
1194 | 1188 |
1195 function SetupFunction() { | 1189 function SetupFunction() { |
1196 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1190 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
1197 "bind", FunctionBind, | 1191 "bind", FunctionBind, |
1198 "toString", FunctionToString | 1192 "toString", FunctionToString |
1199 )); | 1193 )); |
1200 } | 1194 } |
1201 | 1195 |
1202 SetupFunction(); | 1196 SetupFunction(); |
OLD | NEW |