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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 | 256 |
257 static uint32_t SnapshotObjectIdHash(SnapshotObjectId id) { | 257 static uint32_t SnapshotObjectIdHash(SnapshotObjectId id) { |
258 return ComputeIntegerHash(static_cast<uint32_t>(id), | 258 return ComputeIntegerHash(static_cast<uint32_t>(id), |
259 v8::internal::kZeroHashSeed); | 259 v8::internal::kZeroHashSeed); |
260 } | 260 } |
261 | 261 |
262 | 262 |
263 unsigned AllocationTracker::AddFunctionInfo(SharedFunctionInfo* shared, | 263 unsigned AllocationTracker::AddFunctionInfo(SharedFunctionInfo* shared, |
264 SnapshotObjectId id) { | 264 SnapshotObjectId id) { |
265 HashMap::Entry* entry = id_to_function_info_index_.Lookup( | 265 HashMap::Entry* entry = id_to_function_info_index_.LookupOrInsert( |
266 reinterpret_cast<void*>(id), SnapshotObjectIdHash(id), true); | 266 reinterpret_cast<void*>(id), SnapshotObjectIdHash(id)); |
267 if (entry->value == NULL) { | 267 if (entry->value == NULL) { |
268 FunctionInfo* info = new FunctionInfo(); | 268 FunctionInfo* info = new FunctionInfo(); |
269 info->name = names_->GetFunctionName(shared->DebugName()); | 269 info->name = names_->GetFunctionName(shared->DebugName()); |
270 info->function_id = id; | 270 info->function_id = id; |
271 if (shared->script()->IsScript()) { | 271 if (shared->script()->IsScript()) { |
272 Script* script = Script::cast(shared->script()); | 272 Script* script = Script::cast(shared->script()); |
273 if (script->name()->IsName()) { | 273 if (script->name()->IsName()) { |
274 Name* name = Name::cast(script->name()); | 274 Name* name = Name::cast(script->name()); |
275 info->script_name = names_->GetName(name); | 275 info->script_name = names_->GetName(name); |
276 } | 276 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 void AllocationTracker::UnresolvedLocation::HandleWeakScript( | 331 void AllocationTracker::UnresolvedLocation::HandleWeakScript( |
332 const v8::WeakCallbackData<v8::Value, void>& data) { | 332 const v8::WeakCallbackData<v8::Value, void>& data) { |
333 UnresolvedLocation* loc = | 333 UnresolvedLocation* loc = |
334 reinterpret_cast<UnresolvedLocation*>(data.GetParameter()); | 334 reinterpret_cast<UnresolvedLocation*>(data.GetParameter()); |
335 GlobalHandles::Destroy(reinterpret_cast<Object**>(loc->script_.location())); | 335 GlobalHandles::Destroy(reinterpret_cast<Object**>(loc->script_.location())); |
336 loc->script_ = Handle<Script>::null(); | 336 loc->script_ = Handle<Script>::null(); |
337 } | 337 } |
338 | 338 |
339 | 339 |
340 } } // namespace v8::internal | 340 } } // namespace v8::internal |
OLD | NEW |