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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 %SetProperty(obj, p, desc.getValue(), flag); | 442 %SetProperty(obj, p, desc.getValue(), flag); |
443 } else { | 443 } else { |
444 if (IS_FUNCTION(desc.getGet())) %DefineAccessor(obj, p, GETTER, desc.getGet(
), flag); | 444 if (IS_FUNCTION(desc.getGet())) %DefineAccessor(obj, p, GETTER, desc.getGet(
), flag); |
445 if (IS_FUNCTION(desc.getSet())) %DefineAccessor(obj, p, SETTER, desc.getSet(
), flag); | 445 if (IS_FUNCTION(desc.getSet())) %DefineAccessor(obj, p, SETTER, desc.getSet(
), flag); |
446 } | 446 } |
447 return true; | 447 return true; |
448 } | 448 } |
449 | 449 |
450 | 450 |
451 // ES5 section 15.2.3.5. | 451 // ES5 section 15.2.3.5. |
452 function ObjectGetPrototypeOf(obj) { | |
453 if (!(IS_OBJECT(obj) || IS_FUNCTION(obj))) { | |
454 throw MakeTypeError("object_get_prototype_non_object", [obj]); | |
455 } | |
456 return obj.__proto__; | |
457 } | |
458 | |
459 | |
460 // ES5 section 15.2.3.5. | |
461 function ObjectCreate(proto, properties) { | 452 function ObjectCreate(proto, properties) { |
462 if (!IS_OBJECT(proto) && !IS_NULL(proto)) { | 453 if (!IS_OBJECT(proto) && !IS_NULL(proto)) { |
463 throw MakeTypeError("proto_object_or_null", [proto]); | 454 throw MakeTypeError("proto_object_or_null", [proto]); |
464 } | 455 } |
465 var obj = new $Object(); | 456 var obj = new $Object(); |
466 obj.__proto__ = proto; | 457 obj.__proto__ = proto; |
467 if (!IS_UNDEFINED(properties)) ObjectDefineProperties(obj, properties); | 458 if (!IS_UNDEFINED(properties)) ObjectDefineProperties(obj, properties); |
468 return obj; | 459 return obj; |
469 } | 460 } |
470 | 461 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 "hasOwnProperty", ObjectHasOwnProperty, | 505 "hasOwnProperty", ObjectHasOwnProperty, |
515 "isPrototypeOf", ObjectIsPrototypeOf, | 506 "isPrototypeOf", ObjectIsPrototypeOf, |
516 "propertyIsEnumerable", ObjectPropertyIsEnumerable, | 507 "propertyIsEnumerable", ObjectPropertyIsEnumerable, |
517 "__defineGetter__", ObjectDefineGetter, | 508 "__defineGetter__", ObjectDefineGetter, |
518 "__lookupGetter__", ObjectLookupGetter, | 509 "__lookupGetter__", ObjectLookupGetter, |
519 "__defineSetter__", ObjectDefineSetter, | 510 "__defineSetter__", ObjectDefineSetter, |
520 "__lookupSetter__", ObjectLookupSetter | 511 "__lookupSetter__", ObjectLookupSetter |
521 )); | 512 )); |
522 InstallFunctions($Object, DONT_ENUM, $Array( | 513 InstallFunctions($Object, DONT_ENUM, $Array( |
523 "keys", ObjectKeys, | 514 "keys", ObjectKeys, |
524 "create", ObjectCreate, | 515 "create", ObjectCreate |
525 "getPrototypeOf", ObjectGetPrototypeOf | |
526 )); | 516 )); |
527 } | 517 } |
528 | 518 |
529 SetupObject(); | 519 SetupObject(); |
530 | 520 |
531 | 521 |
532 // ---------------------------------------------------------------------------- | 522 // ---------------------------------------------------------------------------- |
533 // Boolean | 523 // Boolean |
534 | 524 |
535 function BooleanToString() { | 525 function BooleanToString() { |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 | 773 |
784 // ---------------------------------------------------------------------------- | 774 // ---------------------------------------------------------------------------- |
785 | 775 |
786 function SetupFunction() { | 776 function SetupFunction() { |
787 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 777 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
788 "toString", FunctionToString | 778 "toString", FunctionToString |
789 )); | 779 )); |
790 } | 780 } |
791 | 781 |
792 SetupFunction(); | 782 SetupFunction(); |
OLD | NEW |