OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 // object->IsConsString() && !object->IsInternalizedString() && | 1312 // object->IsConsString() && !object->IsInternalizedString() && |
1313 // (ConsString::cast(object)->second() == HEAP->empty_string()) | 1313 // (ConsString::cast(object)->second() == HEAP->empty_string()) |
1314 // except the maps for the object and its possible substrings might be | 1314 // except the maps for the object and its possible substrings might be |
1315 // marked. | 1315 // marked. |
1316 HeapObject* object = HeapObject::cast(*p); | 1316 HeapObject* object = HeapObject::cast(*p); |
1317 if (!FLAG_clever_optimizations) return object; | 1317 if (!FLAG_clever_optimizations) return object; |
1318 Map* map = object->map(); | 1318 Map* map = object->map(); |
1319 InstanceType type = map->instance_type(); | 1319 InstanceType type = map->instance_type(); |
1320 if ((type & kShortcutTypeMask) != kShortcutTypeTag) return object; | 1320 if ((type & kShortcutTypeMask) != kShortcutTypeTag) return object; |
1321 | 1321 |
1322 Object* second = reinterpret_cast<ConsString*>(object)->unchecked_second(); | 1322 Object* second = reinterpret_cast<ConsString*>(object)->second(); |
1323 Heap* heap = map->GetHeap(); | 1323 Heap* heap = map->GetHeap(); |
1324 if (second != heap->empty_string()) { | 1324 if (second != heap->empty_string()) { |
1325 return object; | 1325 return object; |
1326 } | 1326 } |
1327 | 1327 |
1328 // Since we don't have the object's start, it is impossible to update the | 1328 // Since we don't have the object's start, it is impossible to update the |
1329 // page dirty marks. Therefore, we only replace the string with its left | 1329 // page dirty marks. Therefore, we only replace the string with its left |
1330 // substring when page dirty marks do not change. | 1330 // substring when page dirty marks do not change. |
1331 Object* first = reinterpret_cast<ConsString*>(object)->unchecked_first(); | 1331 Object* first = reinterpret_cast<ConsString*>(object)->first(); |
1332 if (!heap->InNewSpace(object) && heap->InNewSpace(first)) return object; | 1332 if (!heap->InNewSpace(object) && heap->InNewSpace(first)) return object; |
1333 | 1333 |
1334 *p = first; | 1334 *p = first; |
1335 return HeapObject::cast(first); | 1335 return HeapObject::cast(first); |
1336 } | 1336 } |
1337 | 1337 |
1338 | 1338 |
1339 class MarkCompactMarkingVisitor | 1339 class MarkCompactMarkingVisitor |
1340 : public StaticMarkingVisitor<MarkCompactMarkingVisitor> { | 1340 : public StaticMarkingVisitor<MarkCompactMarkingVisitor> { |
1341 public: | 1341 public: |
(...skipping 2953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4295 while (buffer != NULL) { | 4295 while (buffer != NULL) { |
4296 SlotsBuffer* next_buffer = buffer->next(); | 4296 SlotsBuffer* next_buffer = buffer->next(); |
4297 DeallocateBuffer(buffer); | 4297 DeallocateBuffer(buffer); |
4298 buffer = next_buffer; | 4298 buffer = next_buffer; |
4299 } | 4299 } |
4300 *buffer_address = NULL; | 4300 *buffer_address = NULL; |
4301 } | 4301 } |
4302 | 4302 |
4303 | 4303 |
4304 } } // namespace v8::internal | 4304 } } // namespace v8::internal |
OLD | NEW |