| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 var O = F.prototype; | 385 var O = F.prototype; |
| 386 if (!IS_SPEC_OBJECT(O)) { | 386 if (!IS_SPEC_OBJECT(O)) { |
| 387 throw %MakeTypeError('instanceof_nonobject_proto', [O]); | 387 throw %MakeTypeError('instanceof_nonobject_proto', [O]); |
| 388 } | 388 } |
| 389 | 389 |
| 390 // Return whether or not O is in the prototype chain of V. | 390 // Return whether or not O is in the prototype chain of V. |
| 391 return %IsInPrototypeChain(O, V) ? 0 : 1; | 391 return %IsInPrototypeChain(O, V) ? 0 : 1; |
| 392 } | 392 } |
| 393 | 393 |
| 394 | 394 |
| 395 // Get an array of property keys for the given object. Used in | |
| 396 // for-in statements. | |
| 397 function GET_KEYS() { | |
| 398 return %GetPropertyNames(this); | |
| 399 } | |
| 400 | |
| 401 | |
| 402 // Filter a given key against an object by checking if the object | 395 // Filter a given key against an object by checking if the object |
| 403 // has a property with the given key; return the key as a string if | 396 // has a property with the given key; return the key as a string if |
| 404 // it has. Otherwise returns 0 (smi). Used in for-in statements. | 397 // it has. Otherwise returns 0 (smi). Used in for-in statements. |
| 405 function FILTER_KEY(key) { | 398 function FILTER_KEY(key) { |
| 406 var string = %ToString(key); | 399 var string = %ToString(key); |
| 407 if (%HasProperty(this, string)) return string; | 400 if (%HasProperty(this, string)) return string; |
| 408 return 0; | 401 return 0; |
| 409 } | 402 } |
| 410 | 403 |
| 411 | 404 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 throw %MakeTypeError('cannot_convert_to_primitive', []); | 657 throw %MakeTypeError('cannot_convert_to_primitive', []); |
| 665 } | 658 } |
| 666 | 659 |
| 667 | 660 |
| 668 // NOTE: Setting the prototype for Array must take place as early as | 661 // NOTE: Setting the prototype for Array must take place as early as |
| 669 // possible due to code generation for array literals. When | 662 // possible due to code generation for array literals. When |
| 670 // generating code for a array literal a boilerplate array is created | 663 // generating code for a array literal a boilerplate array is created |
| 671 // that is cloned when running the code. It is essential that the | 664 // that is cloned when running the code. It is essential that the |
| 672 // boilerplate gets the right prototype. | 665 // boilerplate gets the right prototype. |
| 673 %FunctionSetPrototype($Array, new $Array(0)); | 666 %FunctionSetPrototype($Array, new $Array(0)); |
| OLD | NEW |