OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 } | 730 } |
731 } | 731 } |
732 | 732 |
733 | 733 |
734 static inline HeapObject* ShortCircuitConsString(Object** p) { | 734 static inline HeapObject* ShortCircuitConsString(Object** p) { |
735 // Optimization: If the heap object pointed to by p is a non-symbol | 735 // Optimization: If the heap object pointed to by p is a non-symbol |
736 // cons string whose right substring is HEAP->empty_string, update | 736 // cons string whose right substring is HEAP->empty_string, update |
737 // it in place to its left substring. Return the updated value. | 737 // it in place to its left substring. Return the updated value. |
738 // | 738 // |
739 // Here we assume that if we change *p, we replace it with a heap object | 739 // Here we assume that if we change *p, we replace it with a heap object |
740 // (ie, the left substring of a cons string is always a heap object). | 740 // (i.e., the left substring of a cons string is always a heap object). |
741 // | 741 // |
742 // The check performed is: | 742 // The check performed is: |
743 // object->IsConsString() && !object->IsSymbol() && | 743 // object->IsConsString() && !object->IsSymbol() && |
744 // (ConsString::cast(object)->second() == HEAP->empty_string()) | 744 // (ConsString::cast(object)->second() == HEAP->empty_string()) |
745 // except the maps for the object and its possible substrings might be | 745 // except the maps for the object and its possible substrings might be |
746 // marked. | 746 // marked. |
747 HeapObject* object = HeapObject::cast(*p); | 747 HeapObject* object = HeapObject::cast(*p); |
748 if (!FLAG_clever_optimizations) return object; | 748 if (!FLAG_clever_optimizations) return object; |
749 Map* map = object->map(); | 749 Map* map = object->map(); |
750 InstanceType type = map->instance_type(); | 750 InstanceType type = map->instance_type(); |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 // If we did not use the code for kRegExpCodeThreshold mark sweep GCs | 1189 // If we did not use the code for kRegExpCodeThreshold mark sweep GCs |
1190 // we flush the code. | 1190 // we flush the code. |
1191 static void VisitRegExpAndFlushCode(Map* map, HeapObject* object) { | 1191 static void VisitRegExpAndFlushCode(Map* map, HeapObject* object) { |
1192 Heap* heap = map->GetHeap(); | 1192 Heap* heap = map->GetHeap(); |
1193 MarkCompactCollector* collector = heap->mark_compact_collector(); | 1193 MarkCompactCollector* collector = heap->mark_compact_collector(); |
1194 if (!collector->is_code_flushing_enabled()) { | 1194 if (!collector->is_code_flushing_enabled()) { |
1195 VisitJSRegExpFields(map, object); | 1195 VisitJSRegExpFields(map, object); |
1196 return; | 1196 return; |
1197 } | 1197 } |
1198 JSRegExp* re = reinterpret_cast<JSRegExp*>(object); | 1198 JSRegExp* re = reinterpret_cast<JSRegExp*>(object); |
1199 // Flush code or set age on both ascii and two byte code. | 1199 // Flush code or set age on both ASCII and two byte code. |
1200 UpdateRegExpCodeAgeAndFlush(heap, re, true); | 1200 UpdateRegExpCodeAgeAndFlush(heap, re, true); |
1201 UpdateRegExpCodeAgeAndFlush(heap, re, false); | 1201 UpdateRegExpCodeAgeAndFlush(heap, re, false); |
1202 // Visit the fields of the RegExp, including the updated FixedArray. | 1202 // Visit the fields of the RegExp, including the updated FixedArray. |
1203 VisitJSRegExpFields(map, object); | 1203 VisitJSRegExpFields(map, object); |
1204 } | 1204 } |
1205 | 1205 |
1206 | 1206 |
1207 static void VisitSharedFunctionInfoAndFlushCode(Map* map, | 1207 static void VisitSharedFunctionInfoAndFlushCode(Map* map, |
1208 HeapObject* object) { | 1208 HeapObject* object) { |
1209 MarkCompactCollector* collector = map->GetHeap()->mark_compact_collector(); | 1209 MarkCompactCollector* collector = map->GetHeap()->mark_compact_collector(); |
(...skipping 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3904 while (buffer != NULL) { | 3904 while (buffer != NULL) { |
3905 SlotsBuffer* next_buffer = buffer->next(); | 3905 SlotsBuffer* next_buffer = buffer->next(); |
3906 DeallocateBuffer(buffer); | 3906 DeallocateBuffer(buffer); |
3907 buffer = next_buffer; | 3907 buffer = next_buffer; |
3908 } | 3908 } |
3909 *buffer_address = NULL; | 3909 *buffer_address = NULL; |
3910 } | 3910 } |
3911 | 3911 |
3912 | 3912 |
3913 } } // namespace v8::internal | 3913 } } // namespace v8::internal |
OLD | NEW |