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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 int n = subject.length(); | 1078 int n = subject.length(); |
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 pchar c = pattern[i]; | 1088 uc32 c = pattern[i]; |
1089 if (sizeof(schar) == 1 && c > 255) return -1; | 1089 if (sizeof(schar) == 1 && c > 255) return -1; |
1090 bad_char_map[c & kBMHSignificantBitsMask] = m - 1 - i; | 1090 bad_char_map[c & kBMHSignificantBitsMask] = m - 1 - i; |
1091 } | 1091 } |
1092 | 1092 |
1093 for (int i = start_index + m - 1, j = m - 1; i < n;) { | 1093 for (int i = start_index + m - 1, j = m - 1; i < n;) { |
1094 schar c = subject[i]; | 1094 schar c = subject[i]; |
1095 if (c == pattern[j]) { | 1095 if (c == pattern[j]) { |
1096 if (j == 0) { | 1096 if (j == 0) { |
1097 return i; | 1097 return i; |
1098 } | 1098 } |
(...skipping 4158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5257 | 5257 |
5258 void Runtime::PerformGC(Object* result) { | 5258 void Runtime::PerformGC(Object* result) { |
5259 Failure* failure = Failure::cast(result); | 5259 Failure* failure = Failure::cast(result); |
5260 // Try to do a garbage collection; ignore it if it fails. The C | 5260 // 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. | 5261 // entry stub will throw an out-of-memory exception in that case. |
5262 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); | 5262 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); |
5263 } | 5263 } |
5264 | 5264 |
5265 | 5265 |
5266 } } // namespace v8::internal | 5266 } } // namespace v8::internal |
OLD | NEW |