OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 // ECMA-262 section 15.5.4.8 | 121 // ECMA-262 section 15.5.4.8 |
122 function StringLastIndexOf(pat /* position */) { // length == 1 | 122 function StringLastIndexOf(pat /* position */) { // length == 1 |
123 var sub = TO_STRING_INLINE(this); | 123 var sub = TO_STRING_INLINE(this); |
124 var subLength = sub.length; | 124 var subLength = sub.length; |
125 var pat = TO_STRING_INLINE(pat); | 125 var pat = TO_STRING_INLINE(pat); |
126 var patLength = pat.length; | 126 var patLength = pat.length; |
127 var index = subLength - patLength; | 127 var index = subLength - patLength; |
128 if (%_ArgumentsLength() > 1) { | 128 if (%_ArgumentsLength() > 1) { |
129 var position = ToNumber(%_Arguments(1)); | 129 var position = ToNumber(%_Arguments(1)); |
130 if (!$isNaN(position)) { | 130 if (!NUMBER_IS_NAN(position)) { |
131 position = TO_INTEGER(position); | 131 position = TO_INTEGER(position); |
132 if (position < 0) { | 132 if (position < 0) { |
133 position = 0; | 133 position = 0; |
134 } | 134 } |
135 if (position + patLength < subLength) { | 135 if (position + patLength < subLength) { |
136 index = position | 136 index = position |
137 } | 137 } |
138 } | 138 } |
139 } | 139 } |
140 if (index < 0) { | 140 if (index < 0) { |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 "italics", StringItalics, | 911 "italics", StringItalics, |
912 "small", StringSmall, | 912 "small", StringSmall, |
913 "strike", StringStrike, | 913 "strike", StringStrike, |
914 "sub", StringSub, | 914 "sub", StringSub, |
915 "sup", StringSup | 915 "sup", StringSup |
916 )); | 916 )); |
917 } | 917 } |
918 | 918 |
919 | 919 |
920 SetupString(); | 920 SetupString(); |
OLD | NEW |