summaryrefslogtreecommitdiff
path: root/deps/v8/src/profiler/allocation-tracker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/profiler/allocation-tracker.cc')
-rw-r--r--deps/v8/src/profiler/allocation-tracker.cc28
1 files changed, 12 insertions, 16 deletions
diff --git a/deps/v8/src/profiler/allocation-tracker.cc b/deps/v8/src/profiler/allocation-tracker.cc
index 51cb0eb47f..d01060543d 100644
--- a/deps/v8/src/profiler/allocation-tracker.cc
+++ b/deps/v8/src/profiler/allocation-tracker.cc
@@ -213,7 +213,7 @@ void AllocationTracker::AllocationEvent(Address addr, int size) {
JavaScriptFrameIterator it(isolate);
while (!it.done() && length < kMaxAllocationTraceLength) {
JavaScriptFrame* frame = it.frame();
- SharedFunctionInfo* shared = frame->function()->shared();
+ SharedFunctionInfo shared = frame->function()->shared();
SnapshotObjectId id = ids_->FindOrAddEntry(
shared->address(), shared->Size(), false);
allocation_trace_buffer_[length++] = AddFunctionInfo(shared, id);
@@ -237,8 +237,7 @@ static uint32_t SnapshotObjectIdHash(SnapshotObjectId id) {
return ComputeUnseededHash(static_cast<uint32_t>(id));
}
-
-unsigned AllocationTracker::AddFunctionInfo(SharedFunctionInfo* shared,
+unsigned AllocationTracker::AddFunctionInfo(SharedFunctionInfo shared,
SnapshotObjectId id) {
base::HashMap::Entry* entry = id_to_function_info_index_.LookupOrInsert(
reinterpret_cast<void*>(id), SnapshotObjectIdHash(id));
@@ -247,9 +246,9 @@ unsigned AllocationTracker::AddFunctionInfo(SharedFunctionInfo* shared,
info->name = names_->GetName(shared->DebugName());
info->function_id = id;
if (shared->script()->IsScript()) {
- Script* script = Script::cast(shared->script());
+ Script script = Script::cast(shared->script());
if (script->name()->IsName()) {
- Name* name = Name::cast(script->name());
+ Name name = Name::cast(script->name());
info->script_name = names_->GetName(name);
}
info->script_id = script->id();
@@ -264,7 +263,6 @@ unsigned AllocationTracker::AddFunctionInfo(SharedFunctionInfo* shared,
return static_cast<unsigned>(reinterpret_cast<intptr_t>((entry->value)));
}
-
unsigned AllocationTracker::functionInfoIndexForVMState(StateTag state) {
if (state != OTHER) return 0;
if (info_index_for_other_state_ == 0) {
@@ -277,20 +275,18 @@ unsigned AllocationTracker::functionInfoIndexForVMState(StateTag state) {
return info_index_for_other_state_;
}
-
-AllocationTracker::UnresolvedLocation::UnresolvedLocation(
- Script* script, int start, FunctionInfo* info)
- : start_position_(start),
- info_(info) {
+AllocationTracker::UnresolvedLocation::UnresolvedLocation(Script script,
+ int start,
+ FunctionInfo* info)
+ : start_position_(start), info_(info) {
script_ = script->GetIsolate()->global_handles()->Create(script);
- GlobalHandles::MakeWeak(reinterpret_cast<Object**>(script_.location()), this,
- &HandleWeakScript, v8::WeakCallbackType::kParameter);
+ GlobalHandles::MakeWeak(script_.location(), this, &HandleWeakScript,
+ v8::WeakCallbackType::kParameter);
}
-
AllocationTracker::UnresolvedLocation::~UnresolvedLocation() {
if (!script_.is_null()) {
- GlobalHandles::Destroy(reinterpret_cast<Object**>(script_.location()));
+ GlobalHandles::Destroy(script_.location());
}
}
@@ -306,7 +302,7 @@ void AllocationTracker::UnresolvedLocation::HandleWeakScript(
const v8::WeakCallbackInfo<void>& data) {
UnresolvedLocation* loc =
reinterpret_cast<UnresolvedLocation*>(data.GetParameter());
- GlobalHandles::Destroy(reinterpret_cast<Object**>(loc->script_.location()));
+ GlobalHandles::Destroy(loc->script_.location());
loc->script_ = Handle<Script>::null();
}