| 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 PropertyDescriptor.prototype.hasSetter = function() { | 485 PropertyDescriptor.prototype.hasSetter = function() { |
| 486 return this.hasSetter_; | 486 return this.hasSetter_; |
| 487 } | 487 } |
| 488 | 488 |
| 489 | 489 |
| 490 | 490 |
| 491 // ES5 section 8.12.1. | 491 // ES5 section 8.12.1. |
| 492 function GetOwnProperty(obj, p) { | 492 function GetOwnProperty(obj, p) { |
| 493 var desc = new PropertyDescriptor(); | 493 var desc = new PropertyDescriptor(); |
| 494 | 494 |
| 495 // An array with: | 495 // GetOwnProperty returns an array indexed by the constants |
| 496 // obj is a data property [false, value, Writeable, Enumerable, Configurable] | 496 // defined in macros.py. |
| 497 // obj is an accessor [true, Get, Set, Enumerable, Configurable] | 497 // If p is not a property on obj undefined is returned. |
| 498 var props = %GetOwnProperty(ToObject(obj), ToString(p)); | 498 var props = %GetOwnProperty(ToObject(obj), ToString(p)); |
| 499 | 499 |
| 500 if (IS_UNDEFINED(props)) return void 0; | 500 if (IS_UNDEFINED(props)) return void 0; |
| 501 | 501 |
| 502 // This is an accessor | 502 // This is an accessor |
| 503 if (props[0]) { | 503 if (props[IS_ACCESSOR_INDEX]) { |
| 504 desc.setGet(props[1]); | 504 desc.setGet(props[GETTER_INDEX]); |
| 505 desc.setSet(props[2]); | 505 desc.setSet(props[SETTER_INDEX]); |
| 506 } else { | 506 } else { |
| 507 desc.setValue(props[1]); | 507 desc.setValue(props[VALUE_INDEX]); |
| 508 desc.setWritable(props[2]); | 508 desc.setWritable(props[WRITABLE_INDEX]); |
| 509 } | 509 } |
| 510 desc.setEnumerable(props[3]); | 510 desc.setEnumerable(props[ENUMERABLE_INDEX]); |
| 511 desc.setConfigurable(props[4]); | 511 desc.setConfigurable(props[CONFIGURABLE_INDEX]); |
| 512 | 512 |
| 513 return desc; | 513 return desc; |
| 514 } | 514 } |
| 515 | 515 |
| 516 | 516 |
| 517 // ES5 section 8.12.2. | 517 // ES5 section 8.12.2. |
| 518 function GetProperty(obj, p) { | 518 function GetProperty(obj, p) { |
| 519 var prop = GetOwnProperty(obj); | 519 var prop = GetOwnProperty(obj); |
| 520 if (!IS_UNDEFINED(prop)) return prop; | 520 if (!IS_UNDEFINED(prop)) return prop; |
| 521 var proto = obj.__proto__; | 521 var proto = obj.__proto__; |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 | 1030 |
| 1031 // ---------------------------------------------------------------------------- | 1031 // ---------------------------------------------------------------------------- |
| 1032 | 1032 |
| 1033 function SetupFunction() { | 1033 function SetupFunction() { |
| 1034 InstallFunctions($Function.prototype, DONT_ENUM, $Array( | 1034 InstallFunctions($Function.prototype, DONT_ENUM, $Array( |
| 1035 "toString", FunctionToString | 1035 "toString", FunctionToString |
| 1036 )); | 1036 )); |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 SetupFunction(); | 1039 SetupFunction(); |
| OLD | NEW |