| 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 3037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3048 Object* Map::FindInCodeCache(String* name, Code::Flags flags) { | 3048 Object* Map::FindInCodeCache(String* name, Code::Flags flags) { |
| 3049 // Do a lookup if a code cache exists. | 3049 // Do a lookup if a code cache exists. |
| 3050 if (!code_cache()->IsFixedArray()) { | 3050 if (!code_cache()->IsFixedArray()) { |
| 3051 return CodeCache::cast(code_cache())->Lookup(name, flags); | 3051 return CodeCache::cast(code_cache())->Lookup(name, flags); |
| 3052 } else { | 3052 } else { |
| 3053 return Heap::undefined_value(); | 3053 return Heap::undefined_value(); |
| 3054 } | 3054 } |
| 3055 } | 3055 } |
| 3056 | 3056 |
| 3057 | 3057 |
| 3058 int Map::IndexInCodeCache(String* name, Code* code) { | 3058 int Map::IndexInCodeCache(Object* name, Code* code) { |
| 3059 // Get the internal index if a code cache exists. | 3059 // Get the internal index if a code cache exists. |
| 3060 if (!code_cache()->IsFixedArray()) { | 3060 if (!code_cache()->IsFixedArray()) { |
| 3061 return CodeCache::cast(code_cache())->GetIndex(name, code); | 3061 return CodeCache::cast(code_cache())->GetIndex(name, code); |
| 3062 } | 3062 } |
| 3063 return -1; | 3063 return -1; |
| 3064 } | 3064 } |
| 3065 | 3065 |
| 3066 | 3066 |
| 3067 void Map::RemoveFromCodeCache(String* name, Code* code, int index) { | 3067 void Map::RemoveFromCodeCache(String* name, Code* code, int index) { |
| 3068 // No GC is supposed to happen between a call to IndexInCodeCache and | 3068 // No GC is supposed to happen between a call to IndexInCodeCache and |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3193 Object* CodeCache::LookupNormalTypeCache(String* name, Code::Flags flags) { | 3193 Object* CodeCache::LookupNormalTypeCache(String* name, Code::Flags flags) { |
| 3194 if (!normal_type_cache()->IsUndefined()) { | 3194 if (!normal_type_cache()->IsUndefined()) { |
| 3195 CodeCacheHashTable* cache = CodeCacheHashTable::cast(normal_type_cache()); | 3195 CodeCacheHashTable* cache = CodeCacheHashTable::cast(normal_type_cache()); |
| 3196 return cache->Lookup(name, flags); | 3196 return cache->Lookup(name, flags); |
| 3197 } else { | 3197 } else { |
| 3198 return Heap::undefined_value(); | 3198 return Heap::undefined_value(); |
| 3199 } | 3199 } |
| 3200 } | 3200 } |
| 3201 | 3201 |
| 3202 | 3202 |
| 3203 int CodeCache::GetIndex(String* name, Code* code) { | 3203 int CodeCache::GetIndex(Object* name, Code* code) { |
| 3204 // This is not used for normal load/store/call IC's. | |
| 3205 if (code->type() == NORMAL) { | 3204 if (code->type() == NORMAL) { |
| 3206 if (normal_type_cache()->IsUndefined()) return -1; | 3205 if (normal_type_cache()->IsUndefined()) return -1; |
| 3207 CodeCacheHashTable* cache = CodeCacheHashTable::cast(normal_type_cache()); | 3206 CodeCacheHashTable* cache = CodeCacheHashTable::cast(normal_type_cache()); |
| 3208 return cache->GetIndex(name, code->flags()); | 3207 return cache->GetIndex(String::cast(name), code->flags()); |
| 3209 } | 3208 } |
| 3210 | 3209 |
| 3211 FixedArray* array = default_cache(); | 3210 FixedArray* array = default_cache(); |
| 3212 int len = array->length(); | 3211 int len = array->length(); |
| 3213 for (int i = 0; i < len; i += kCodeCacheEntrySize) { | 3212 for (int i = 0; i < len; i += kCodeCacheEntrySize) { |
| 3214 if (array->get(i + kCodeCacheEntryCodeOffset) == code) return i + 1; | 3213 if (array->get(i + kCodeCacheEntryCodeOffset) == code) return i + 1; |
| 3215 } | 3214 } |
| 3216 return -1; | 3215 return -1; |
| 3217 } | 3216 } |
| 3218 | 3217 |
| 3219 | 3218 |
| 3220 void CodeCache::RemoveByIndex(String* name, Code* code, int index) { | 3219 void CodeCache::RemoveByIndex(Object* name, Code* code, int index) { |
| 3221 if (code->type() == NORMAL) { | 3220 if (code->type() == NORMAL) { |
| 3222 ASSERT(!normal_type_cache()->IsUndefined()); | 3221 ASSERT(!normal_type_cache()->IsUndefined()); |
| 3223 CodeCacheHashTable* cache = CodeCacheHashTable::cast(normal_type_cache()); | 3222 CodeCacheHashTable* cache = CodeCacheHashTable::cast(normal_type_cache()); |
| 3224 ASSERT(cache->GetIndex(name, code->flags()) == index); | 3223 ASSERT(cache->GetIndex(String::cast(name), code->flags()) == index); |
| 3225 cache->RemoveByIndex(index); | 3224 cache->RemoveByIndex(index); |
| 3226 } else { | 3225 } else { |
| 3227 FixedArray* array = default_cache(); | 3226 FixedArray* array = default_cache(); |
| 3228 ASSERT(array->length() >= index && array->get(index)->IsCode()); | 3227 ASSERT(array->length() >= index && array->get(index)->IsCode()); |
| 3229 // Use null instead of undefined for deleted elements to distinguish | 3228 // Use null instead of undefined for deleted elements to distinguish |
| 3230 // deleted elements from unused elements. This distinction is used | 3229 // deleted elements from unused elements. This distinction is used |
| 3231 // when looking up in the cache and when updating the cache. | 3230 // when looking up in the cache and when updating the cache. |
| 3232 ASSERT_EQ(1, kCodeCacheEntryCodeOffset - kCodeCacheEntryNameOffset); | 3231 ASSERT_EQ(1, kCodeCacheEntryCodeOffset - kCodeCacheEntryNameOffset); |
| 3233 array->set_null(index - 1); // Name. | 3232 array->set_null(index - 1); // Name. |
| 3234 array->set_null(index); // Code. | 3233 array->set_null(index); // Code. |
| (...skipping 5345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8580 if (break_point_objects()->IsUndefined()) return 0; | 8579 if (break_point_objects()->IsUndefined()) return 0; |
| 8581 // Single beak point. | 8580 // Single beak point. |
| 8582 if (!break_point_objects()->IsFixedArray()) return 1; | 8581 if (!break_point_objects()->IsFixedArray()) return 1; |
| 8583 // Multiple break points. | 8582 // Multiple break points. |
| 8584 return FixedArray::cast(break_point_objects())->length(); | 8583 return FixedArray::cast(break_point_objects())->length(); |
| 8585 } | 8584 } |
| 8586 #endif | 8585 #endif |
| 8587 | 8586 |
| 8588 | 8587 |
| 8589 } } // namespace v8::internal | 8588 } } // namespace v8::internal |
| OLD | NEW |