Chromium Code Reviews| 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 9153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9164 if (Marking::IsBlack(Marking::MarkBitFrom(start_of_string))) { | 9164 if (Marking::IsBlack(Marking::MarkBitFrom(start_of_string))) { |
| 9165 MemoryChunk::IncrementLiveBytesFromMutator(start_of_string, -delta); | 9165 MemoryChunk::IncrementLiveBytesFromMutator(start_of_string, -delta); |
| 9166 } | 9166 } |
| 9167 | 9167 |
| 9168 | 9168 |
| 9169 if (new_length == 0) return heap->isolate()->factory()->empty_string(); | 9169 if (new_length == 0) return heap->isolate()->factory()->empty_string(); |
| 9170 return string; | 9170 return string; |
| 9171 } | 9171 } |
| 9172 | 9172 |
| 9173 | 9173 |
| 9174 AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object, | 9174 AllocationMemento* AllocationMemento::FindForHeapObject(HeapObject* object, |
| 9175 bool in_GC) { | 9175 bool in_GC) { |
| 9176 // Currently, AllocationMemento objects are only allocated immediately | 9176 // AllocationMemento objects are only allocated immediately after objects in |
| 9177 // after JSArrays and some JSObjects in NewSpace. Detecting whether a | 9177 // NewSpace. Detecting whether a memento is present involves carefully |
| 9178 // memento is present involves carefully checking the object immediately | 9178 // checking the object immediately after the current object (if there is one) |
| 9179 // after the current object (if there is one) to see if it's an | 9179 // to see if it's an AllocationMemento. |
| 9180 // AllocationMemento. | 9180 ASSERT(object->GetHeap()->InNewSpace(object)); |
| 9181 if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) { | 9181 if (FLAG_track_allocation_sites) { |
|
mvstanton
2013/12/04 16:16:50
I think you want to add the check in method JSObje
Hannes Payer (out of office)
2013/12/04 16:28:30
Done.
| |
| 9182 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + | 9182 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + |
| 9183 object->Size(); | 9183 object->Size(); |
| 9184 Address top; | 9184 Address top; |
| 9185 if (in_GC) { | 9185 if (in_GC) { |
| 9186 top = object->GetHeap()->new_space()->FromSpacePageHigh(); | 9186 top = object->GetHeap()->new_space()->FromSpacePageHigh(); |
| 9187 } else { | 9187 } else { |
| 9188 top = object->GetHeap()->NewSpaceTop(); | 9188 top = object->GetHeap()->NewSpaceTop(); |
| 9189 } | 9189 } |
| 9190 if ((ptr_end + AllocationMemento::kSize) <= top) { | 9190 if ((ptr_end + AllocationMemento::kSize) <= top) { |
| 9191 // There is room in newspace for allocation info. Do we have some? | 9191 // There is room in newspace for allocation info. Do we have some? |
| (...skipping 3687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12879 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), | 12879 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), |
| 12880 object->UpdateAllocationSite(to_kind)); | 12880 object->UpdateAllocationSite(to_kind)); |
| 12881 } | 12881 } |
| 12882 | 12882 |
| 12883 | 12883 |
| 12884 MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) { | 12884 MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) { |
| 12885 if (!FLAG_track_allocation_sites || !IsJSArray()) { | 12885 if (!FLAG_track_allocation_sites || !IsJSArray()) { |
| 12886 return this; | 12886 return this; |
| 12887 } | 12887 } |
| 12888 | 12888 |
| 12889 AllocationMemento* memento = AllocationMemento::FindForJSObject(this); | 12889 AllocationMemento* memento = AllocationMemento::FindForHeapObject(this); |
| 12890 if (memento == NULL || !memento->IsValid()) { | 12890 if (memento == NULL || !memento->IsValid()) { |
| 12891 return this; | 12891 return this; |
| 12892 } | 12892 } |
| 12893 | 12893 |
| 12894 // Walk through to the Allocation Site | 12894 // Walk through to the Allocation Site |
| 12895 AllocationSite* site = memento->GetAllocationSite(); | 12895 AllocationSite* site = memento->GetAllocationSite(); |
| 12896 return site->DigestTransitionFeedback(to_kind); | 12896 return site->DigestTransitionFeedback(to_kind); |
| 12897 } | 12897 } |
| 12898 | 12898 |
| 12899 | 12899 |
| (...skipping 3751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16651 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16651 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16652 static const char* error_messages_[] = { | 16652 static const char* error_messages_[] = { |
| 16653 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16653 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16654 }; | 16654 }; |
| 16655 #undef ERROR_MESSAGES_TEXTS | 16655 #undef ERROR_MESSAGES_TEXTS |
| 16656 return error_messages_[reason]; | 16656 return error_messages_[reason]; |
| 16657 } | 16657 } |
| 16658 | 16658 |
| 16659 | 16659 |
| 16660 } } // namespace v8::internal | 16660 } } // namespace v8::internal |
| OLD | NEW |