| 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 |
| 11 | 11 |
| 12 /* ----------------------------------- | 12 /* ----------------------------------- |
| 13 - - - C o m p a r i s o n - - - | 13 - - - C o m p a r i s o n - - - |
| 14 ----------------------------------- | 14 ----------------------------------- |
| 15 */ | 15 */ |
| 16 | 16 |
| 17 // The following declarations are shared with other native JS files. | 17 // The following declarations are shared with other native JS files. |
| 18 // They are all declared at this one spot to avoid redeclaration errors. | 18 // They are all declared at this one spot to avoid redeclaration errors. |
| 19 var $Object = global.Object; | 19 var $Object = global.Object; |
| 20 var $Array = global.Array; | 20 var $Array = global.Array; |
| 21 var $String = global.String; | 21 var $String = global.String; |
| 22 var $Number = global.Number; | 22 var $Number = global.Number; |
| 23 var $Function = global.Function; | 23 var $Function = global.Function; |
| 24 var $Boolean = global.Boolean; | 24 var $Boolean = global.Boolean; |
| 25 var $NaN = %GetRootNaN(); |
| 25 | 26 |
| 26 // ECMA-262 Section 11.9.3. | 27 // ECMA-262 Section 11.9.3. |
| 27 function EQUALS(y) { | 28 function EQUALS(y) { |
| 28 if (IS_STRING(this) && IS_STRING(y)) return %StringEquals(this, y); | 29 if (IS_STRING(this) && IS_STRING(y)) return %StringEquals(this, y); |
| 29 var x = this; | 30 var x = this; |
| 30 | 31 |
| 31 while (true) { | 32 while (true) { |
| 32 if (IS_NUMBER(x)) { | 33 if (IS_NUMBER(x)) { |
| 33 while (true) { | 34 while (true) { |
| 34 if (IS_NUMBER(y)) return %NumberEquals(x, y); | 35 if (IS_NUMBER(y)) return %NumberEquals(x, y); |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 | 778 |
| 778 /* ----------------------------------------------- | 779 /* ----------------------------------------------- |
| 779 - - - J a v a S c r i p t S t u b s - - - | 780 - - - J a v a S c r i p t S t u b s - - - |
| 780 ----------------------------------------------- | 781 ----------------------------------------------- |
| 781 */ | 782 */ |
| 782 | 783 |
| 783 function STRING_LENGTH_STUB(name) { | 784 function STRING_LENGTH_STUB(name) { |
| 784 var receiver = this; // implicit first parameter | 785 var receiver = this; // implicit first parameter |
| 785 return %_StringGetLength(%_JSValueGetValue(receiver)); | 786 return %_StringGetLength(%_JSValueGetValue(receiver)); |
| 786 } | 787 } |
| OLD | NEW |