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