| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 if (length > 0x800000) { | 345 if (length > 0x800000) { |
| 346 throw %MakeRangeError('apply_overflow', [length]); | 346 throw %MakeRangeError('apply_overflow', [length]); |
| 347 } | 347 } |
| 348 | 348 |
| 349 if (!IS_FUNCTION(this)) { | 349 if (!IS_FUNCTION(this)) { |
| 350 throw %MakeTypeError('apply_non_function', [ %ToString(this), typeof this ])
; | 350 throw %MakeTypeError('apply_non_function', [ %ToString(this), typeof this ])
; |
| 351 } | 351 } |
| 352 | 352 |
| 353 // Make sure the arguments list has the right type. | 353 // Make sure the arguments list has the right type. |
| 354 if (args != null && | 354 if (args != null && |
| 355 %ClassOf(args) != 'Array' && | 355 !%IsArrayClass(args) && |
| 356 %ClassOf(args) != 'Arguments') { | 356 !%IsArgumentsClass(args)) { |
| 357 throw %MakeTypeError('apply_wrong_args', []); | 357 throw %MakeTypeError('apply_wrong_args', []); |
| 358 } | 358 } |
| 359 | 359 |
| 360 // Return the length which is the number of arguments to copy to the | 360 // Return the length which is the number of arguments to copy to the |
| 361 // stack. It is guaranteed to be a small integer at this point. | 361 // stack. It is guaranteed to be a small integer at this point. |
| 362 return length; | 362 return length; |
| 363 } | 363 } |
| 364 | 364 |
| 365 | 365 |
| 366 function APPLY_OVERFLOW(length) { | 366 function APPLY_OVERFLOW(length) { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 throw %MakeTypeError('cannot_convert_to_primitive', []); | 515 throw %MakeTypeError('cannot_convert_to_primitive', []); |
| 516 } | 516 } |
| 517 | 517 |
| 518 | 518 |
| 519 // NOTE: Setting the prototype for Array must take place as early as | 519 // NOTE: Setting the prototype for Array must take place as early as |
| 520 // possible due to code generation for array literals. When | 520 // possible due to code generation for array literals. When |
| 521 // generating code for a array literal a boilerplate array is created | 521 // generating code for a array literal a boilerplate array is created |
| 522 // that is cloned when running the code. It is essiential that the | 522 // that is cloned when running the code. It is essiential that the |
| 523 // boilerplate gets the right prototype. | 523 // boilerplate gets the right prototype. |
| 524 %FunctionSetPrototype($Array, new $Array(0)); | 524 %FunctionSetPrototype($Array, new $Array(0)); |
| OLD | NEW |