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 // 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 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 // Cap bad char table to last p chars of pattern. Also max skip value. | 1079 // Cap bad char table to last p chars of pattern. Also max skip value. |
1080 int p = m < kBMHSignificantSuffixLength ? m : kBMHSignificantSuffixLength; | 1080 int p = m < kBMHSignificantSuffixLength ? m : kBMHSignificantSuffixLength; |
1081 | 1081 |
1082 memset(bad_char_map, p, kBMHBadCharCount); | 1082 memset(bad_char_map, p, kBMHBadCharCount); |
1083 | 1083 |
1084 // Run forwards to populate bad_char_table, so that *last* instance | 1084 // Run forwards to populate bad_char_table, so that *last* instance |
1085 // of character equivalence class is the one registered. | 1085 // of character equivalence class is the one registered. |
1086 // Notice: Doesn't include last character. | 1086 // Notice: Doesn't include last character. |
1087 for (int i = p < m ? m - p : 0; i < m - 1; i++) { | 1087 for (int i = p < m ? m - p : 0; i < m - 1; i++) { |
1088 uc32 c = pattern[i]; | 1088 uc32 c = pattern[i]; |
1089 if (sizeof(schar) == 1 && c > 255) return -1; | 1089 if (sizeof(schar) == 1 && |
| 1090 sizeof(pchar) > 1 && |
| 1091 c > String::kMaxAsciiCharCode) { |
| 1092 return -1; |
| 1093 } |
1090 bad_char_map[c & kBMHSignificantBitsMask] = m - 1 - i; | 1094 bad_char_map[c & kBMHSignificantBitsMask] = m - 1 - i; |
1091 } | 1095 } |
1092 | 1096 |
1093 for (int i = start_index + m - 1, j = m - 1; i < n;) { | 1097 for (int i = start_index + m - 1, j = m - 1; i < n;) { |
1094 schar c = subject[i]; | 1098 schar c = subject[i]; |
1095 if (c == pattern[j]) { | 1099 if (c == pattern[j]) { |
1096 if (j == 0) { | 1100 if (j == 0) { |
1097 return i; | 1101 return i; |
1098 } | 1102 } |
1099 j--; | 1103 j--; |
(...skipping 4157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5257 | 5261 |
5258 void Runtime::PerformGC(Object* result) { | 5262 void Runtime::PerformGC(Object* result) { |
5259 Failure* failure = Failure::cast(result); | 5263 Failure* failure = Failure::cast(result); |
5260 // Try to do a garbage collection; ignore it if it fails. The C | 5264 // Try to do a garbage collection; ignore it if it fails. The C |
5261 // entry stub will throw an out-of-memory exception in that case. | 5265 // entry stub will throw an out-of-memory exception in that case. |
5262 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); | 5266 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); |
5263 } | 5267 } |
5264 | 5268 |
5265 | 5269 |
5266 } } // namespace v8::internal | 5270 } } // namespace v8::internal |
OLD | NEW |