OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 9031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9042 if (Marking::IsBlack(Marking::MarkBitFrom(start_of_string))) { | 9042 if (Marking::IsBlack(Marking::MarkBitFrom(start_of_string))) { |
9043 MemoryChunk::IncrementLiveBytesFromMutator(start_of_string, -delta); | 9043 MemoryChunk::IncrementLiveBytesFromMutator(start_of_string, -delta); |
9044 } | 9044 } |
9045 | 9045 |
9046 | 9046 |
9047 if (new_length == 0) return heap->isolate()->factory()->empty_string(); | 9047 if (new_length == 0) return heap->isolate()->factory()->empty_string(); |
9048 return string; | 9048 return string; |
9049 } | 9049 } |
9050 | 9050 |
9051 | 9051 |
9052 AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object) { | 9052 AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object, |
| 9053 bool in_GC) { |
9053 // Currently, AllocationMemento objects are only allocated immediately | 9054 // Currently, AllocationMemento objects are only allocated immediately |
9054 // after JSArrays in NewSpace, and detecting whether a JSArray has one | 9055 // after JSArrays in NewSpace, and detecting whether a JSArray has one |
9055 // involves carefully checking the object immediately after the JSArray | 9056 // involves carefully checking the object immediately after the JSArray |
9056 // (if there is one) to see if it's an AllocationMemento. | 9057 // (if there is one) to see if it's an AllocationMemento. |
9057 if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) { | 9058 if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) { |
9058 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + | 9059 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + |
9059 object->Size(); | 9060 object->Size(); |
9060 if ((ptr_end + AllocationMemento::kSize) <= | 9061 Address top; |
9061 object->GetHeap()->NewSpaceTop()) { | 9062 if (in_GC) { |
| 9063 top = object->GetHeap()->new_space()->FromSpacePageHigh(); |
| 9064 } else { |
| 9065 top = object->GetHeap()->NewSpaceTop(); |
| 9066 } |
| 9067 if ((ptr_end + AllocationMemento::kSize) <= top) { |
9062 // There is room in newspace for allocation info. Do we have some? | 9068 // There is room in newspace for allocation info. Do we have some? |
9063 Map** possible_allocation_memento_map = | 9069 Map** possible_allocation_memento_map = |
9064 reinterpret_cast<Map**>(ptr_end); | 9070 reinterpret_cast<Map**>(ptr_end); |
9065 if (*possible_allocation_memento_map == | 9071 if (*possible_allocation_memento_map == |
9066 object->GetHeap()->allocation_memento_map()) { | 9072 object->GetHeap()->allocation_memento_map()) { |
9067 AllocationMemento* memento = AllocationMemento::cast( | 9073 AllocationMemento* memento = AllocationMemento::cast( |
9068 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); | 9074 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); |
9069 return memento; | 9075 return memento; |
9070 } | 9076 } |
9071 } | 9077 } |
(...skipping 7091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16163 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16169 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16164 static const char* error_messages_[] = { | 16170 static const char* error_messages_[] = { |
16165 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16171 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16166 }; | 16172 }; |
16167 #undef ERROR_MESSAGES_TEXTS | 16173 #undef ERROR_MESSAGES_TEXTS |
16168 return error_messages_[reason]; | 16174 return error_messages_[reason]; |
16169 } | 16175 } |
16170 | 16176 |
16171 | 16177 |
16172 } } // namespace v8::internal | 16178 } } // namespace v8::internal |
OLD | NEW |