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