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

Side by Side Diff: src/allocation-tracker.cc

Issue 876613002: Only use FreeSpace objects in the free list. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments Created 5 years, 10 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
« no previous file with comments | « no previous file | src/api.cc » ('j') | 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 // 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/allocation-tracker.h" 7 #include "src/allocation-tracker.h"
8 #include "src/frames-inl.h" 8 #include "src/frames-inl.h"
9 #include "src/heap-snapshot-generator.h" 9 #include "src/heap-snapshot-generator.h"
10 10
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 220 }
221 } 221 }
222 222
223 223
224 void AllocationTracker::AllocationEvent(Address addr, int size) { 224 void AllocationTracker::AllocationEvent(Address addr, int size) {
225 DisallowHeapAllocation no_allocation; 225 DisallowHeapAllocation no_allocation;
226 Heap* heap = ids_->heap(); 226 Heap* heap = ids_->heap();
227 227
228 // Mark the new block as FreeSpace to make sure the heap is iterable 228 // Mark the new block as FreeSpace to make sure the heap is iterable
229 // while we are capturing stack trace. 229 // while we are capturing stack trace.
230 FreeListNode::FromAddress(addr)->set_size(heap, size); 230 heap->CreateFillerObjectAt(addr, size);
231 DCHECK_EQ(HeapObject::FromAddress(addr)->Size(), size);
232 DCHECK(FreeListNode::IsFreeListNode(HeapObject::FromAddress(addr)));
233 231
234 Isolate* isolate = heap->isolate(); 232 Isolate* isolate = heap->isolate();
235 int length = 0; 233 int length = 0;
236 StackTraceFrameIterator it(isolate); 234 StackTraceFrameIterator it(isolate);
237 while (!it.done() && length < kMaxAllocationTraceLength) { 235 while (!it.done() && length < kMaxAllocationTraceLength) {
238 JavaScriptFrame* frame = it.frame(); 236 JavaScriptFrame* frame = it.frame();
239 SharedFunctionInfo* shared = frame->function()->shared(); 237 SharedFunctionInfo* shared = frame->function()->shared();
240 SnapshotObjectId id = ids_->FindOrAddEntry( 238 SnapshotObjectId id = ids_->FindOrAddEntry(
241 shared->address(), shared->Size(), false); 239 shared->address(), shared->Size(), false);
242 allocation_trace_buffer_[length++] = AddFunctionInfo(shared, id); 240 allocation_trace_buffer_[length++] = AddFunctionInfo(shared, id);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 void AllocationTracker::UnresolvedLocation::HandleWeakScript( 331 void AllocationTracker::UnresolvedLocation::HandleWeakScript(
334 const v8::WeakCallbackData<v8::Value, void>& data) { 332 const v8::WeakCallbackData<v8::Value, void>& data) {
335 UnresolvedLocation* loc = 333 UnresolvedLocation* loc =
336 reinterpret_cast<UnresolvedLocation*>(data.GetParameter()); 334 reinterpret_cast<UnresolvedLocation*>(data.GetParameter());
337 GlobalHandles::Destroy(reinterpret_cast<Object**>(loc->script_.location())); 335 GlobalHandles::Destroy(reinterpret_cast<Object**>(loc->script_.location()));
338 loc->script_ = Handle<Script>::null(); 336 loc->script_ = Handle<Script>::null();
339 } 337 }
340 338
341 339
342 } } // namespace v8::internal 340 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698