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 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This files contains runtime support implemented in JavaScript. | 5 // This files contains runtime support implemented in JavaScript. |
6 | 6 |
7 // CAUTION: Some of the functions specified in this file are called | 7 // CAUTION: Some of the functions specified in this file are called |
8 // directly from compiled code. These are the functions with names in | 8 // directly from compiled code. These are the functions with names in |
9 // ALL CAPS. The compiled code passes the first argument in 'this'. | 9 // ALL CAPS. The compiled code passes the first argument in 'this'. |
10 | 10 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 216 |
217 | 217 |
218 // ECMA-262, section 11.5.3, page 49. | 218 // ECMA-262, section 11.5.3, page 49. |
219 function MOD(y) { | 219 function MOD(y) { |
220 var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this); | 220 var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this); |
221 if (!IS_NUMBER(y)) y = %NonNumberToNumber(y); | 221 if (!IS_NUMBER(y)) y = %NonNumberToNumber(y); |
222 return %NumberMod(x, y); | 222 return %NumberMod(x, y); |
223 } | 223 } |
224 | 224 |
225 | 225 |
| 226 // ECMA-262, section 11.5.3, page 49. |
| 227 function EXP(y) { |
| 228 var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this); |
| 229 if (!IS_NUMBER(y)) y = %NonNumberToNumber(y); |
| 230 return %_MathPow(x, y); |
| 231 } |
| 232 |
| 233 |
226 | 234 |
227 /* ------------------------------------------- | 235 /* ------------------------------------------- |
228 - - - B i t o p e r a t i o n s - - - | 236 - - - B i t o p e r a t i o n s - - - |
229 ------------------------------------------- | 237 ------------------------------------------- |
230 */ | 238 */ |
231 | 239 |
232 // ECMA-262, section 11.10, page 57. | 240 // ECMA-262, section 11.10, page 57. |
233 function BIT_OR(y) { | 241 function BIT_OR(y) { |
234 var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this); | 242 var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this); |
235 if (!IS_NUMBER(y)) y = %NonNumberToNumber(y); | 243 if (!IS_NUMBER(y)) y = %NonNumberToNumber(y); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 return i; | 695 return i; |
688 } | 696 } |
689 | 697 |
690 | 698 |
691 // NOTE: Setting the prototype for Array must take place as early as | 699 // NOTE: Setting the prototype for Array must take place as early as |
692 // possible due to code generation for array literals. When | 700 // possible due to code generation for array literals. When |
693 // generating code for a array literal a boilerplate array is created | 701 // generating code for a array literal a boilerplate array is created |
694 // that is cloned when running the code. It is essential that the | 702 // that is cloned when running the code. It is essential that the |
695 // boilerplate gets the right prototype. | 703 // boilerplate gets the right prototype. |
696 %FunctionSetPrototype($Array, new $Array(0)); | 704 %FunctionSetPrototype($Array, new $Array(0)); |
OLD | NEW |