OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compilation-cache.h" | 9 #include "src/compilation-cache.h" |
10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 // | 1343 // |
1344 // The check performed is: | 1344 // The check performed is: |
1345 // object->IsConsString() && !object->IsInternalizedString() && | 1345 // object->IsConsString() && !object->IsInternalizedString() && |
1346 // (ConsString::cast(object)->second() == HEAP->empty_string()) | 1346 // (ConsString::cast(object)->second() == HEAP->empty_string()) |
1347 // except the maps for the object and its possible substrings might be | 1347 // except the maps for the object and its possible substrings might be |
1348 // marked. | 1348 // marked. |
1349 HeapObject* object = HeapObject::cast(*p); | 1349 HeapObject* object = HeapObject::cast(*p); |
1350 if (!FLAG_clever_optimizations) return object; | 1350 if (!FLAG_clever_optimizations) return object; |
1351 Map* map = object->map(); | 1351 Map* map = object->map(); |
1352 InstanceType type = map->instance_type(); | 1352 InstanceType type = map->instance_type(); |
1353 if ((type & kShortcutTypeMask) != kShortcutTypeTag) return object; | 1353 if (!IsShortcutCandidate(type)) return object; |
1354 | 1354 |
1355 Object* second = reinterpret_cast<ConsString*>(object)->second(); | 1355 Object* second = reinterpret_cast<ConsString*>(object)->second(); |
1356 Heap* heap = map->GetHeap(); | 1356 Heap* heap = map->GetHeap(); |
1357 if (second != heap->empty_string()) { | 1357 if (second != heap->empty_string()) { |
1358 return object; | 1358 return object; |
1359 } | 1359 } |
1360 | 1360 |
1361 // Since we don't have the object's start, it is impossible to update the | 1361 // Since we don't have the object's start, it is impossible to update the |
1362 // page dirty marks. Therefore, we only replace the string with its left | 1362 // page dirty marks. Therefore, we only replace the string with its left |
1363 // substring when page dirty marks do not change. | 1363 // substring when page dirty marks do not change. |
(...skipping 3137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4501 while (buffer != NULL) { | 4501 while (buffer != NULL) { |
4502 SlotsBuffer* next_buffer = buffer->next(); | 4502 SlotsBuffer* next_buffer = buffer->next(); |
4503 DeallocateBuffer(buffer); | 4503 DeallocateBuffer(buffer); |
4504 buffer = next_buffer; | 4504 buffer = next_buffer; |
4505 } | 4505 } |
4506 *buffer_address = NULL; | 4506 *buffer_address = NULL; |
4507 } | 4507 } |
4508 | 4508 |
4509 | 4509 |
4510 } } // namespace v8::internal | 4510 } } // namespace v8::internal |
OLD | NEW |