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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 } | 354 } |
355 | 355 |
356 | 356 |
357 // ECMA-262, section 11.8.6, page 54. To make the implementation more | 357 // ECMA-262, section 11.8.6, page 54. To make the implementation more |
358 // efficient, the return value should be zero if the 'this' is an | 358 // efficient, the return value should be zero if the 'this' is an |
359 // instance of F, and non-zero if not. This makes it possible to avoid | 359 // instance of F, and non-zero if not. This makes it possible to avoid |
360 // an expensive ToBoolean conversion in the generated code. | 360 // an expensive ToBoolean conversion in the generated code. |
361 function INSTANCE_OF(F) { | 361 function INSTANCE_OF(F) { |
362 var V = this; | 362 var V = this; |
363 if (!IS_SPEC_FUNCTION(F)) { | 363 if (!IS_SPEC_FUNCTION(F)) { |
364 throw %MakeTypeError('instanceof_function_expected', [V]); | 364 throw %MakeTypeError('instanceof_function_expected', [F]); |
365 } | 365 } |
366 | 366 |
367 // If V is not an object, return false. | 367 // If V is not an object, return false. |
368 if (!IS_SPEC_OBJECT(V)) { | 368 if (!IS_SPEC_OBJECT(V)) { |
369 return 1; | 369 return 1; |
370 } | 370 } |
371 | 371 |
372 // Check if function is bound, if so, get [[BoundFunction]] from it | 372 // Check if function is bound, if so, get [[BoundFunction]] from it |
373 // and use that instead of F. | 373 // and use that instead of F. |
374 var bindings = %BoundFunctionGetBindings(F); | 374 var bindings = %BoundFunctionGetBindings(F); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 return i; | 667 return i; |
668 } | 668 } |
669 | 669 |
670 | 670 |
671 // NOTE: Setting the prototype for Array must take place as early as | 671 // NOTE: Setting the prototype for Array must take place as early as |
672 // possible due to code generation for array literals. When | 672 // possible due to code generation for array literals. When |
673 // generating code for a array literal a boilerplate array is created | 673 // generating code for a array literal a boilerplate array is created |
674 // that is cloned when running the code. It is essential that the | 674 // that is cloned when running the code. It is essential that the |
675 // boilerplate gets the right prototype. | 675 // boilerplate gets the right prototype. |
676 %FunctionSetPrototype($Array, new $Array(0)); | 676 %FunctionSetPrototype($Array, new $Array(0)); |
OLD | NEW |