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(); | |
26 | 25 |
27 // ECMA-262 Section 11.9.3. | 26 // ECMA-262 Section 11.9.3. |
28 function EQUALS(y) { | 27 function EQUALS(y) { |
29 if (IS_STRING(this) && IS_STRING(y)) return %StringEquals(this, y); | 28 if (IS_STRING(this) && IS_STRING(y)) return %StringEquals(this, y); |
30 var x = this; | 29 var x = this; |
31 | 30 |
32 while (true) { | 31 while (true) { |
33 if (IS_NUMBER(x)) { | 32 if (IS_NUMBER(x)) { |
34 while (true) { | 33 while (true) { |
35 if (IS_NUMBER(y)) return %NumberEquals(x, y); | 34 if (IS_NUMBER(y)) return %NumberEquals(x, y); |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 | 777 |
779 /* ----------------------------------------------- | 778 /* ----------------------------------------------- |
780 - - - J a v a S c r i p t S t u b s - - - | 779 - - - J a v a S c r i p t S t u b s - - - |
781 ----------------------------------------------- | 780 ----------------------------------------------- |
782 */ | 781 */ |
783 | 782 |
784 function STRING_LENGTH_STUB(name) { | 783 function STRING_LENGTH_STUB(name) { |
785 var receiver = this; // implicit first parameter | 784 var receiver = this; // implicit first parameter |
786 return %_StringGetLength(%_JSValueGetValue(receiver)); | 785 return %_StringGetLength(%_JSValueGetValue(receiver)); |
787 } | 786 } |
OLD | NEW |