Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Side by Side Diff: src/runtime.cc

Issue 1074003: Fix windows build. (Closed)
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 2347
2348 return -1; 2348 return -1;
2349 } 2349 }
2350 2350
2351 2351
2352 template <typename schar> 2352 template <typename schar>
2353 static inline int SingleCharIndexOf(Vector<const schar> string, 2353 static inline int SingleCharIndexOf(Vector<const schar> string,
2354 schar pattern_char, 2354 schar pattern_char,
2355 int start_index) { 2355 int start_index) {
2356 if (sizeof(schar) == 1) { 2356 if (sizeof(schar) == 1) {
2357 schar* pos = reinterpret_cast<schar*>( 2357 const schar* pos = reinterpret_cast<const schar*>(
2358 memchr(string.start() + start_index, 2358 memchr(string.start() + start_index,
2359 pattern_char, 2359 pattern_char,
2360 string.length() - start_index)); 2360 string.length() - start_index));
2361 if (pos == NULL) return -1; 2361 if (pos == NULL) return -1;
2362 return pos - string.start(); 2362 return pos - string.start();
2363 } 2363 }
2364 for (int i = start_index, n = string.length(); i < n; i++) { 2364 for (int i = start_index, n = string.length(); i < n; i++) {
2365 if (pattern_char == string[i]) { 2365 if (pattern_char == string[i]) {
2366 return i; 2366 return i;
2367 } 2367 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 // We know our pattern is at least 2 characters, we cache the first so 2402 // We know our pattern is at least 2 characters, we cache the first so
2403 // the common case of the first character not matching is faster. 2403 // the common case of the first character not matching is faster.
2404 pchar pattern_first_char = pattern[0]; 2404 pchar pattern_first_char = pattern[0];
2405 for (int i = idx, n = subject.length() - pattern.length(); i <= n; i++) { 2405 for (int i = idx, n = subject.length() - pattern.length(); i <= n; i++) {
2406 badness++; 2406 badness++;
2407 if (badness > 0) { 2407 if (badness > 0) {
2408 *complete = false; 2408 *complete = false;
2409 return i; 2409 return i;
2410 } 2410 }
2411 if (sizeof(schar) == 1 && sizeof(pchar) == 1) { 2411 if (sizeof(schar) == 1 && sizeof(pchar) == 1) {
2412 schar* pos = reinterpret_cast<schar*>(memchr(subject.start() + i, 2412 const schar* pos = reinterpret_cast<const schar*>(
2413 pattern_first_char, 2413 memchr(subject.start() + i,
2414 n - i + 1)); 2414 pattern_first_char,
2415 n - i + 1));
2415 if (pos == NULL) { 2416 if (pos == NULL) {
2416 *complete = true; 2417 *complete = true;
2417 return -1; 2418 return -1;
2418 } 2419 }
2419 i = pos - subject.start(); 2420 i = pos - subject.start();
2420 } else { 2421 } else {
2421 if (subject[i] != pattern_first_char) continue; 2422 if (subject[i] != pattern_first_char) continue;
2422 } 2423 }
2423 int j = 1; 2424 int j = 1;
2424 do { 2425 do {
(...skipping 6975 matching lines...) Expand 10 before | Expand all | Expand 10 after
9400 } else { 9401 } else {
9401 // Handle last resort GC and make sure to allow future allocations 9402 // Handle last resort GC and make sure to allow future allocations
9402 // to grow the heap without causing GCs (if possible). 9403 // to grow the heap without causing GCs (if possible).
9403 Counters::gc_last_resort_from_js.Increment(); 9404 Counters::gc_last_resort_from_js.Increment();
9404 Heap::CollectAllGarbage(false); 9405 Heap::CollectAllGarbage(false);
9405 } 9406 }
9406 } 9407 }
9407 9408
9408 9409
9409 } } // namespace v8::internal 9410 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698