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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 287 |
288 | 288 |
289 // ECMA-262, section 11.10, page 57. | 289 // ECMA-262, section 11.10, page 57. |
290 function BIT_XOR(y) { | 290 function BIT_XOR(y) { |
291 var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this); | 291 var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this); |
292 if (!IS_NUMBER(y)) y = %NonNumberToNumber(y); | 292 if (!IS_NUMBER(y)) y = %NonNumberToNumber(y); |
293 return %NumberXor(x, y); | 293 return %NumberXor(x, y); |
294 } | 294 } |
295 | 295 |
296 | 296 |
| 297 // ECMA-262, section 11.4.7, page 47. |
| 298 function UNARY_MINUS() { |
| 299 var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this); |
| 300 return %NumberUnaryMinus(x); |
| 301 } |
| 302 |
| 303 |
| 304 // ECMA-262, section 11.4.8, page 48. |
| 305 function BIT_NOT() { |
| 306 var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this); |
| 307 return %NumberNot(x); |
| 308 } |
| 309 |
| 310 |
297 // ECMA-262, section 11.7.1, page 51. | 311 // ECMA-262, section 11.7.1, page 51. |
298 function SHL(y) { | 312 function SHL(y) { |
299 var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this); | 313 var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this); |
300 if (!IS_NUMBER(y)) y = %NonNumberToNumber(y); | 314 if (!IS_NUMBER(y)) y = %NonNumberToNumber(y); |
301 return %NumberShl(x, y); | 315 return %NumberShl(x, y); |
302 } | 316 } |
303 | 317 |
304 | 318 |
305 // ECMA-262, section 11.7.2, page 51. | 319 // ECMA-262, section 11.7.2, page 51. |
306 function SAR(y) { | 320 function SAR(y) { |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 return i; | 681 return i; |
668 } | 682 } |
669 | 683 |
670 | 684 |
671 // NOTE: Setting the prototype for Array must take place as early as | 685 // NOTE: Setting the prototype for Array must take place as early as |
672 // possible due to code generation for array literals. When | 686 // possible due to code generation for array literals. When |
673 // generating code for a array literal a boilerplate array is created | 687 // generating code for a array literal a boilerplate array is created |
674 // that is cloned when running the code. It is essential that the | 688 // that is cloned when running the code. It is essential that the |
675 // boilerplate gets the right prototype. | 689 // boilerplate gets the right prototype. |
676 %FunctionSetPrototype($Array, new $Array(0)); | 690 %FunctionSetPrototype($Array, new $Array(0)); |
OLD | NEW |