| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 List<UnresolvedLocation*> copy(unresolved_locations_.length()); | 162 List<UnresolvedLocation*> copy(unresolved_locations_.length()); |
| 163 copy.AddAll(unresolved_locations_); | 163 copy.AddAll(unresolved_locations_); |
| 164 unresolved_locations_.Clear(); | 164 unresolved_locations_.Clear(); |
| 165 for (int i = 0; i < copy.length(); i++) { | 165 for (int i = 0; i < copy.length(); i++) { |
| 166 copy[i]->Resolve(); | 166 copy[i]->Resolve(); |
| 167 delete copy[i]; | 167 delete copy[i]; |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| 172 void AllocationTracker::NewObjectEvent(Address addr, int size) { | 172 void AllocationTracker::AllocationEvent(Address addr, int size) { |
| 173 DisallowHeapAllocation no_allocation; | 173 DisallowHeapAllocation no_allocation; |
| 174 Heap* heap = ids_->heap(); | 174 Heap* heap = ids_->heap(); |
| 175 | 175 |
| 176 // Mark the new block as FreeSpace to make sure the heap is iterable | 176 // Mark the new block as FreeSpace to make sure the heap is iterable |
| 177 // while we are capturing stack trace. | 177 // while we are capturing stack trace. |
| 178 FreeListNode::FromAddress(addr)->set_size(heap, size); | 178 FreeListNode::FromAddress(addr)->set_size(heap, size); |
| 179 ASSERT_EQ(HeapObject::FromAddress(addr)->Size(), size); | 179 ASSERT_EQ(HeapObject::FromAddress(addr)->Size(), size); |
| 180 ASSERT(FreeListNode::IsFreeListNode(HeapObject::FromAddress(addr))); | 180 ASSERT(FreeListNode::IsFreeListNode(HeapObject::FromAddress(addr))); |
| 181 | 181 |
| 182 Isolate* isolate = heap->isolate(); | 182 Isolate* isolate = heap->isolate(); |
| 183 int length = 0; | 183 int length = 0; |
| 184 StackTraceFrameIterator it(isolate); | 184 StackTraceFrameIterator it(isolate); |
| 185 while (!it.done() && length < kMaxAllocationTraceLength) { | 185 while (!it.done() && length < kMaxAllocationTraceLength) { |
| 186 JavaScriptFrame* frame = it.frame(); | 186 JavaScriptFrame* frame = it.frame(); |
| 187 SharedFunctionInfo* shared = frame->function()->shared(); | 187 SharedFunctionInfo* shared = frame->function()->shared(); |
| 188 SnapshotObjectId id = ids_->FindEntry(shared->address()); | 188 SnapshotObjectId id = ids_->FindOrAddEntry( |
| 189 shared->address(), shared->Size(), false); |
| 189 allocation_trace_buffer_[length++] = id; | 190 allocation_trace_buffer_[length++] = id; |
| 190 AddFunctionInfo(shared, id); | 191 AddFunctionInfo(shared, id); |
| 191 it.Advance(); | 192 it.Advance(); |
| 192 } | 193 } |
| 193 AllocationTraceNode* top_node = trace_tree_.AddPathFromEnd( | 194 AllocationTraceNode* top_node = trace_tree_.AddPathFromEnd( |
| 194 Vector<SnapshotObjectId>(allocation_trace_buffer_, length)); | 195 Vector<SnapshotObjectId>(allocation_trace_buffer_, length)); |
| 195 top_node->AddAllocation(size); | 196 top_node->AddAllocation(size); |
| 196 } | 197 } |
| 197 | 198 |
| 198 | 199 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 v8::Isolate* isolate, | 271 v8::Isolate* isolate, |
| 271 v8::Persistent<v8::Value>* obj, | 272 v8::Persistent<v8::Value>* obj, |
| 272 void* data) { | 273 void* data) { |
| 273 UnresolvedLocation* location = reinterpret_cast<UnresolvedLocation*>(data); | 274 UnresolvedLocation* location = reinterpret_cast<UnresolvedLocation*>(data); |
| 274 location->script_ = Handle<Script>::null(); | 275 location->script_ = Handle<Script>::null(); |
| 275 obj->Reset(); | 276 obj->Reset(); |
| 276 } | 277 } |
| 277 | 278 |
| 278 | 279 |
| 279 } } // namespace v8::internal | 280 } } // namespace v8::internal |
| OLD | NEW |