| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 if (IS_SYMBOL(y) || IS_SIMD_VALUE(y)) return 1; // not equal | 56 if (IS_SYMBOL(y) || IS_SIMD_VALUE(y)) return 1; // not equal |
| 57 // String or boolean. | 57 // String or boolean. |
| 58 return %NumberEquals(x, %to_number_fun(y)); | 58 return %NumberEquals(x, %to_number_fun(y)); |
| 59 } | 59 } |
| 60 y = %to_primitive(y, NO_HINT); | 60 y = %to_primitive(y, NO_HINT); |
| 61 } | 61 } |
| 62 } else if (IS_STRING(x)) { | 62 } else if (IS_STRING(x)) { |
| 63 while (true) { | 63 while (true) { |
| 64 if (IS_STRING(y)) return %StringEquals(x, y); | 64 if (IS_STRING(y)) return %StringEquals(x, y); |
| 65 if (IS_NUMBER(y)) return %NumberEquals(%to_number_fun(x), y); | 65 if (IS_NUMBER(y)) return %NumberEquals(%to_number_fun(x), y); |
| 66 if (IS_BOOLEAN(y)) return %NumberEquals(%to_number_fun(x), %to_number_fu
n(y)); | 66 if (IS_BOOLEAN(y)) { |
| 67 return %NumberEquals(%to_number_fun(x), %to_number_fun(y)); |
| 68 } |
| 67 if (IS_NULL_OR_UNDEFINED(y)) return 1; // not equal | 69 if (IS_NULL_OR_UNDEFINED(y)) return 1; // not equal |
| 68 if (IS_SYMBOL(y) || IS_SIMD_VALUE(y)) return 1; // not equal | 70 if (IS_SYMBOL(y) || IS_SIMD_VALUE(y)) return 1; // not equal |
| 69 y = %to_primitive(y, NO_HINT); | 71 y = %to_primitive(y, NO_HINT); |
| 70 } | 72 } |
| 71 } else if (IS_SYMBOL(x)) { | 73 } else if (IS_SYMBOL(x)) { |
| 72 if (IS_SYMBOL(y)) return %_ObjectEquals(x, y) ? 0 : 1; | 74 if (IS_SYMBOL(y)) return %_ObjectEquals(x, y) ? 0 : 1; |
| 73 return 1; // not equal | 75 return 1; // not equal |
| 74 } else if (IS_BOOLEAN(x)) { | 76 } else if (IS_BOOLEAN(x)) { |
| 75 if (IS_BOOLEAN(y)) return %_ObjectEquals(x, y) ? 0 : 1; | 77 if (IS_BOOLEAN(y)) return %_ObjectEquals(x, y) ? 0 : 1; |
| 76 if (IS_NULL_OR_UNDEFINED(y)) return 1; | 78 if (IS_NULL_OR_UNDEFINED(y)) return 1; |
| 77 if (IS_NUMBER(y)) return %NumberEquals(%to_number_fun(x), y); | 79 if (IS_NUMBER(y)) return %NumberEquals(%to_number_fun(x), y); |
| 78 if (IS_STRING(y)) return %NumberEquals(%to_number_fun(x), %to_number_fun(y
)); | 80 if (IS_STRING(y)) { |
| 81 return %NumberEquals(%to_number_fun(x), %to_number_fun(y)); |
| 82 } |
| 79 if (IS_SYMBOL(y) || IS_SIMD_VALUE(y)) return 1; // not equal | 83 if (IS_SYMBOL(y) || IS_SIMD_VALUE(y)) return 1; // not equal |
| 80 // y is object. | 84 // y is object. |
| 81 x = %to_number_fun(x); | 85 x = %to_number_fun(x); |
| 82 y = %to_primitive(y, NO_HINT); | 86 y = %to_primitive(y, NO_HINT); |
| 83 } else if (IS_NULL_OR_UNDEFINED(x)) { | 87 } else if (IS_NULL_OR_UNDEFINED(x)) { |
| 84 return IS_NULL_OR_UNDEFINED(y) ? 0 : 1; | 88 return IS_NULL_OR_UNDEFINED(y) ? 0 : 1; |
| 85 } else if (IS_SIMD_VALUE(x)) { | 89 } else if (IS_SIMD_VALUE(x)) { |
| 86 if (!IS_SIMD_VALUE(y)) return 1; // not equal | 90 if (!IS_SIMD_VALUE(y)) return 1; // not equal |
| 87 return %SimdEquals(x, y); | 91 return %SimdEquals(x, y); |
| 88 } else { | 92 } else { |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 utils.Export(function(to) { | 899 utils.Export(function(to) { |
| 896 to.ToBoolean = ToBoolean; | 900 to.ToBoolean = ToBoolean; |
| 897 to.ToLength = ToLength; | 901 to.ToLength = ToLength; |
| 898 to.ToName = ToName; | 902 to.ToName = ToName; |
| 899 to.ToNumber = ToNumber; | 903 to.ToNumber = ToNumber; |
| 900 to.ToPrimitive = ToPrimitive; | 904 to.ToPrimitive = ToPrimitive; |
| 901 to.ToString = ToString; | 905 to.ToString = ToString; |
| 902 }); | 906 }); |
| 903 | 907 |
| 904 }) | 908 }) |
| OLD | NEW |