OLD | NEW |
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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 FreeListNode::FromAddress(addr)->set_size(heap, size); |
231 ASSERT_EQ(HeapObject::FromAddress(addr)->Size(), size); | 231 DCHECK_EQ(HeapObject::FromAddress(addr)->Size(), size); |
232 ASSERT(FreeListNode::IsFreeListNode(HeapObject::FromAddress(addr))); | 232 DCHECK(FreeListNode::IsFreeListNode(HeapObject::FromAddress(addr))); |
233 | 233 |
234 Isolate* isolate = heap->isolate(); | 234 Isolate* isolate = heap->isolate(); |
235 int length = 0; | 235 int length = 0; |
236 StackTraceFrameIterator it(isolate); | 236 StackTraceFrameIterator it(isolate); |
237 while (!it.done() && length < kMaxAllocationTraceLength) { | 237 while (!it.done() && length < kMaxAllocationTraceLength) { |
238 JavaScriptFrame* frame = it.frame(); | 238 JavaScriptFrame* frame = it.frame(); |
239 SharedFunctionInfo* shared = frame->function()->shared(); | 239 SharedFunctionInfo* shared = frame->function()->shared(); |
240 SnapshotObjectId id = ids_->FindOrAddEntry( | 240 SnapshotObjectId id = ids_->FindOrAddEntry( |
241 shared->address(), shared->Size(), false); | 241 shared->address(), shared->Size(), false); |
242 allocation_trace_buffer_[length++] = AddFunctionInfo(shared, id); | 242 allocation_trace_buffer_[length++] = AddFunctionInfo(shared, id); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 void AllocationTracker::UnresolvedLocation::HandleWeakScript( | 333 void AllocationTracker::UnresolvedLocation::HandleWeakScript( |
334 const v8::WeakCallbackData<v8::Value, void>& data) { | 334 const v8::WeakCallbackData<v8::Value, void>& data) { |
335 UnresolvedLocation* loc = | 335 UnresolvedLocation* loc = |
336 reinterpret_cast<UnresolvedLocation*>(data.GetParameter()); | 336 reinterpret_cast<UnresolvedLocation*>(data.GetParameter()); |
337 GlobalHandles::Destroy(reinterpret_cast<Object**>(loc->script_.location())); | 337 GlobalHandles::Destroy(reinterpret_cast<Object**>(loc->script_.location())); |
338 loc->script_ = Handle<Script>::null(); | 338 loc->script_ = Handle<Script>::null(); |
339 } | 339 } |
340 | 340 |
341 | 341 |
342 } } // namespace v8::internal | 342 } } // namespace v8::internal |
OLD | NEW |