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 10083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10094 return cache->get(i + 1); | 10094 return cache->get(i + 1); |
10095 } | 10095 } |
10096 } | 10096 } |
10097 | 10097 |
10098 // Cache miss. If we have spare room, put new data into it, otherwise | 10098 // Cache miss. If we have spare room, put new data into it, otherwise |
10099 // evict post finger entry which must be least recently used. | 10099 // evict post finger entry which must be least recently used. |
10100 if (size < cache->length()) { | 10100 if (size < cache->length()) { |
10101 cache->set(JSFunctionResultCache::kCacheSizeIndex, Smi::FromInt(size + 2)); | 10101 cache->set(JSFunctionResultCache::kCacheSizeIndex, Smi::FromInt(size + 2)); |
10102 return CacheMiss(cache, size, key); | 10102 return CacheMiss(cache, size, key); |
10103 } else { | 10103 } else { |
10104 int target_index = (finger_index < cache->length()) ? | 10104 int target_index = finger_index + JSFunctionResultCache::kEntrySize; |
10105 finger_index + 2 : JSFunctionResultCache::kEntriesIndex; | 10105 if (target_index == cache->length()) { |
| 10106 target_index = JSFunctionResultCache::kEntriesIndex; |
| 10107 } |
10106 return CacheMiss(cache, target_index, key); | 10108 return CacheMiss(cache, target_index, key); |
10107 } | 10109 } |
10108 } | 10110 } |
10109 | 10111 |
10110 #ifdef DEBUG | 10112 #ifdef DEBUG |
10111 // ListNatives is ONLY used by the fuzz-natives.js in debug mode | 10113 // ListNatives is ONLY used by the fuzz-natives.js in debug mode |
10112 // Exclude the code in release mode. | 10114 // Exclude the code in release mode. |
10113 static Object* Runtime_ListNatives(Arguments args) { | 10115 static Object* Runtime_ListNatives(Arguments args) { |
10114 ASSERT(args.length() == 0); | 10116 ASSERT(args.length() == 0); |
10115 HandleScope scope; | 10117 HandleScope scope; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10199 } else { | 10201 } else { |
10200 // Handle last resort GC and make sure to allow future allocations | 10202 // Handle last resort GC and make sure to allow future allocations |
10201 // to grow the heap without causing GCs (if possible). | 10203 // to grow the heap without causing GCs (if possible). |
10202 Counters::gc_last_resort_from_js.Increment(); | 10204 Counters::gc_last_resort_from_js.Increment(); |
10203 Heap::CollectAllGarbage(false); | 10205 Heap::CollectAllGarbage(false); |
10204 } | 10206 } |
10205 } | 10207 } |
10206 | 10208 |
10207 | 10209 |
10208 } } // namespace v8::internal | 10210 } } // namespace v8::internal |
OLD | NEW |