| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // The allocation may well happen inside a builtin so it is OK for the |
| 185 // iterator to see builtins on the call stack. |
| 186 StackTraceFrameIterator it(isolate, true); |
| 185 while (!it.done() && length < kMaxAllocationTraceLength) { | 187 while (!it.done() && length < kMaxAllocationTraceLength) { |
| 186 JavaScriptFrame* frame = it.frame(); | 188 JavaScriptFrame* frame = it.frame(); |
| 187 SharedFunctionInfo* shared = frame->function()->shared(); | 189 SharedFunctionInfo* shared = frame->function()->shared(); |
| 188 SnapshotObjectId id = ids_->FindEntry(shared->address()); | 190 SnapshotObjectId id = ids_->FindEntry(shared->address()); |
| 189 allocation_trace_buffer_[length++] = id; | 191 allocation_trace_buffer_[length++] = id; |
| 190 AddFunctionInfo(shared, id); | 192 AddFunctionInfo(shared, id); |
| 191 it.Advance(); | 193 it.Advance(); |
| 192 } | 194 } |
| 193 AllocationTraceNode* top_node = trace_tree_.AddPathFromEnd( | 195 AllocationTraceNode* top_node = trace_tree_.AddPathFromEnd( |
| 194 Vector<SnapshotObjectId>(allocation_trace_buffer_, length)); | 196 Vector<SnapshotObjectId>(allocation_trace_buffer_, length)); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 v8::Isolate* isolate, | 272 v8::Isolate* isolate, |
| 271 v8::Persistent<v8::Value>* obj, | 273 v8::Persistent<v8::Value>* obj, |
| 272 void* data) { | 274 void* data) { |
| 273 UnresolvedLocation* location = reinterpret_cast<UnresolvedLocation*>(data); | 275 UnresolvedLocation* location = reinterpret_cast<UnresolvedLocation*>(data); |
| 274 location->script_ = Handle<Script>::null(); | 276 location->script_ = Handle<Script>::null(); |
| 275 obj->Dispose(); | 277 obj->Dispose(); |
| 276 } | 278 } |
| 277 | 279 |
| 278 | 280 |
| 279 } } // namespace v8::internal | 281 } } // namespace v8::internal |
| OLD | NEW |