Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: src/objects.cc

Issue 234703003: Unify mechanism to find trailing AllocationMementos (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12788 matching lines...) Expand 10 before | Expand all | Expand 10 after
12799 void JSObject::UpdateAllocationSite(Handle<JSObject> object, 12799 void JSObject::UpdateAllocationSite(Handle<JSObject> object,
12800 ElementsKind to_kind) { 12800 ElementsKind to_kind) {
12801 if (!object->IsJSArray()) return; 12801 if (!object->IsJSArray()) return;
12802 12802
12803 Heap* heap = object->GetHeap(); 12803 Heap* heap = object->GetHeap();
12804 if (!heap->InNewSpace(*object)) return; 12804 if (!heap->InNewSpace(*object)) return;
12805 12805
12806 Handle<AllocationSite> site; 12806 Handle<AllocationSite> site;
12807 { 12807 {
12808 DisallowHeapAllocation no_allocation; 12808 DisallowHeapAllocation no_allocation;
12809 // Check if there is potentially a memento behind the object. If
12810 // the last word of the momento is on another page we return
12811 // immediatelly.
12812 Address object_address = object->address();
12813 Address memento_address = object_address + JSArray::kSize;
12814 Address last_memento_word_address = memento_address + kPointerSize;
12815 if (!NewSpacePage::OnSamePage(object_address,
12816 last_memento_word_address)) {
12817 return;
12818 }
12819 12809
12820 // Either object is the last object in the new space, or there is another 12810 AllocationMemento* memento = heap->FindAllocationMemento(*object);
12821 // object of at least word size (the header map word) following it, so 12811 if (memento == NULL) return;
12822 // suffices to compare ptr and top here.
12823 Address top = heap->NewSpaceTop();
12824 ASSERT(memento_address == top ||
12825 memento_address + HeapObject::kHeaderSize <= top);
12826 if (memento_address == top) return;
12827
12828 HeapObject* candidate = HeapObject::FromAddress(memento_address);
12829 if (candidate->map() != heap->allocation_memento_map()) return;
12830
12831 AllocationMemento* memento = AllocationMemento::cast(candidate);
12832 if (!memento->IsValid()) return;
12833 12812
12834 // Walk through to the Allocation Site 12813 // Walk through to the Allocation Site
12835 site = handle(memento->GetAllocationSite()); 12814 site = handle(memento->GetAllocationSite());
12836 } 12815 }
12837 AllocationSite::DigestTransitionFeedback(site, to_kind); 12816 AllocationSite::DigestTransitionFeedback(site, to_kind);
12838 } 12817 }
12839 12818
12840 12819
12841 void JSObject::TransitionElementsKind(Handle<JSObject> object, 12820 void JSObject::TransitionElementsKind(Handle<JSObject> object,
12842 ElementsKind to_kind) { 12821 ElementsKind to_kind) {
(...skipping 3786 matching lines...) Expand 10 before | Expand all | Expand 10 after
16629 #define ERROR_MESSAGES_TEXTS(C, T) T, 16608 #define ERROR_MESSAGES_TEXTS(C, T) T,
16630 static const char* error_messages_[] = { 16609 static const char* error_messages_[] = {
16631 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16610 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16632 }; 16611 };
16633 #undef ERROR_MESSAGES_TEXTS 16612 #undef ERROR_MESSAGES_TEXTS
16634 return error_messages_[reason]; 16613 return error_messages_[reason];
16635 } 16614 }
16636 16615
16637 16616
16638 } } // namespace v8::internal 16617 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698