| 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 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 | 1161 |
| 1162 // Cache for mapping (array, property name) into descriptor index. | 1162 // Cache for mapping (array, property name) into descriptor index. |
| 1163 // The cache contains both positive and negative results. | 1163 // The cache contains both positive and negative results. |
| 1164 // Descriptor index equals kNotFound means the property is absent. | 1164 // Descriptor index equals kNotFound means the property is absent. |
| 1165 // Cleared at startup and prior to any gc. | 1165 // Cleared at startup and prior to any gc. |
| 1166 class DescriptorLookupCache { | 1166 class DescriptorLookupCache { |
| 1167 public: | 1167 public: |
| 1168 // Lookup descriptor index for (map, name). | 1168 // Lookup descriptor index for (map, name). |
| 1169 // If absent, kAbsent is returned. | 1169 // If absent, kAbsent is returned. |
| 1170 static int Lookup(DescriptorArray* array, String* name) { | 1170 static int Lookup(DescriptorArray* array, String* name) { |
| 1171 if(!StringShape(name).IsSymbol()) return kAbsent; | 1171 if (!StringShape(name).IsSymbol()) return kAbsent; |
| 1172 int index = Hash(array, name); | 1172 int index = Hash(array, name); |
| 1173 Key& key = keys_[index]; | 1173 Key& key = keys_[index]; |
| 1174 if ((key.array == array) && (key.name == name)) return results_[index]; | 1174 if ((key.array == array) && (key.name == name)) return results_[index]; |
| 1175 return kAbsent; | 1175 return kAbsent; |
| 1176 } | 1176 } |
| 1177 | 1177 |
| 1178 // Update an element in the cache. | 1178 // Update an element in the cache. |
| 1179 static void Update(DescriptorArray* array, String* name, int result) { | 1179 static void Update(DescriptorArray* array, String* name, int result) { |
| 1180 ASSERT(result != kAbsent); | 1180 ASSERT(result != kAbsent); |
| 1181 if(StringShape(name).IsSymbol()) { | 1181 if (StringShape(name).IsSymbol()) { |
| 1182 int index = Hash(array, name); | 1182 int index = Hash(array, name); |
| 1183 Key& key = keys_[index]; | 1183 Key& key = keys_[index]; |
| 1184 key.array = array; | 1184 key.array = array; |
| 1185 key.name = name; | 1185 key.name = name; |
| 1186 results_[index] = result; | 1186 results_[index] = result; |
| 1187 } | 1187 } |
| 1188 } | 1188 } |
| 1189 | 1189 |
| 1190 // Clear the cache. | 1190 // Clear the cache. |
| 1191 static void Clear(); | 1191 static void Clear(); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 int marked_count_; | 1381 int marked_count_; |
| 1382 | 1382 |
| 1383 // The count from the end of the previous full GC. Will be zero if there | 1383 // The count from the end of the previous full GC. Will be zero if there |
| 1384 // was no previous full GC. | 1384 // was no previous full GC. |
| 1385 int previous_marked_count_; | 1385 int previous_marked_count_; |
| 1386 }; | 1386 }; |
| 1387 | 1387 |
| 1388 } } // namespace v8::internal | 1388 } } // namespace v8::internal |
| 1389 | 1389 |
| 1390 #endif // V8_HEAP_H_ | 1390 #endif // V8_HEAP_H_ |
| OLD | NEW |