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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 380 |
381 // Get an array of property keys for the given object. Used in | 381 // Get an array of property keys for the given object. Used in |
382 // for-in statements. | 382 // for-in statements. |
383 function GET_KEYS() { | 383 function GET_KEYS() { |
384 return %GetPropertyNames(this); | 384 return %GetPropertyNames(this); |
385 } | 385 } |
386 | 386 |
387 | 387 |
388 // Filter a given key against an object by checking if the object | 388 // Filter a given key against an object by checking if the object |
389 // has a property with the given key; return the key as a string if | 389 // has a property with the given key; return the key as a string if |
390 // it has. Otherwise returns null. Used in for-in statements. | 390 // it has. Otherwise returns 0 (smi). Used in for-in statements. |
391 function FILTER_KEY(key) { | 391 function FILTER_KEY(key) { |
392 var string = %ToString(key); | 392 var string = %ToString(key); |
393 if (%HasProperty(this, string)) return string; | 393 if (%HasProperty(this, string)) return string; |
394 return null; | 394 return 0; |
395 } | 395 } |
396 | 396 |
397 | 397 |
398 function CALL_NON_FUNCTION() { | 398 function CALL_NON_FUNCTION() { |
399 var delegate = %GetFunctionDelegate(this); | 399 var delegate = %GetFunctionDelegate(this); |
400 if (!IS_FUNCTION(delegate)) { | 400 if (!IS_FUNCTION(delegate)) { |
401 throw %MakeTypeError('called_non_callable', [typeof this]); | 401 throw %MakeTypeError('called_non_callable', [typeof this]); |
402 } | 402 } |
403 return delegate.apply(this, arguments); | 403 return delegate.apply(this, arguments); |
404 } | 404 } |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 throw %MakeTypeError('cannot_convert_to_primitive', []); | 620 throw %MakeTypeError('cannot_convert_to_primitive', []); |
621 } | 621 } |
622 | 622 |
623 | 623 |
624 // NOTE: Setting the prototype for Array must take place as early as | 624 // NOTE: Setting the prototype for Array must take place as early as |
625 // possible due to code generation for array literals. When | 625 // possible due to code generation for array literals. When |
626 // generating code for a array literal a boilerplate array is created | 626 // generating code for a array literal a boilerplate array is created |
627 // that is cloned when running the code. It is essiential that the | 627 // that is cloned when running the code. It is essiential that the |
628 // boilerplate gets the right prototype. | 628 // boilerplate gets the right prototype. |
629 %FunctionSetPrototype($Array, new $Array(0)); | 629 %FunctionSetPrototype($Array, new $Array(0)); |
OLD | NEW |