| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/profiler/sampling-heap-profiler.h" | 5 #include "src/profiler/sampling-heap-profiler.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/base/utils/random-number-generator.h" | 10 #include "src/base/utils/random-number-generator.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 Handle<Script> script = non_const_scripts[node->script_id_]; | 226 Handle<Script> script = non_const_scripts[node->script_id_]; |
| 227 if (!script.is_null()) { | 227 if (!script.is_null()) { |
| 228 if (script->name()->IsName()) { | 228 if (script->name()->IsName()) { |
| 229 Name* name = Name::cast(script->name()); | 229 Name* name = Name::cast(script->name()); |
| 230 script_name = ToApiHandle<v8::String>( | 230 script_name = ToApiHandle<v8::String>( |
| 231 isolate_->factory()->InternalizeUtf8String(names_->GetName(name))); | 231 isolate_->factory()->InternalizeUtf8String(names_->GetName(name))); |
| 232 } | 232 } |
| 233 line = 1 + Script::GetLineNumber(script, node->script_position_); | 233 line = 1 + Script::GetLineNumber(script, node->script_position_); |
| 234 column = 1 + Script::GetColumnNumber(script, node->script_position_); | 234 column = 1 + Script::GetColumnNumber(script, node->script_position_); |
| 235 } | 235 } |
| 236 for (auto alloc : node->allocations_) { | 236 } |
| 237 allocations.push_back(ScaleSample(alloc.first, alloc.second)); | 237 for (auto alloc : node->allocations_) { |
| 238 } | 238 allocations.push_back(ScaleSample(alloc.first, alloc.second)); |
| 239 } | 239 } |
| 240 | 240 |
| 241 profile->nodes().push_back(v8::AllocationProfile::Node( | 241 profile->nodes().push_back(v8::AllocationProfile::Node( |
| 242 {ToApiHandle<v8::String>( | 242 {ToApiHandle<v8::String>( |
| 243 isolate_->factory()->InternalizeUtf8String(node->name_)), | 243 isolate_->factory()->InternalizeUtf8String(node->name_)), |
| 244 script_name, node->script_id_, node->script_position_, line, column, | 244 script_name, node->script_id_, node->script_position_, line, column, |
| 245 std::vector<v8::AllocationProfile::Node*>(), allocations})); | 245 std::vector<v8::AllocationProfile::Node*>(), allocations})); |
| 246 v8::AllocationProfile::Node* current = &profile->nodes().back(); | 246 v8::AllocationProfile::Node* current = &profile->nodes().back(); |
| 247 size_t child_len = node->children_.size(); | 247 size_t child_len = node->children_.size(); |
| 248 // The children vector may have nodes appended to it during translation | 248 // The children vector may have nodes appended to it during translation |
| (...skipping 24 matching lines...) Expand all Loading... |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 auto profile = new v8::internal::AllocationProfile(); | 275 auto profile = new v8::internal::AllocationProfile(); |
| 276 TranslateAllocationNode(profile, &profile_root_, scripts); | 276 TranslateAllocationNode(profile, &profile_root_, scripts); |
| 277 return profile; | 277 return profile; |
| 278 } | 278 } |
| 279 | 279 |
| 280 | 280 |
| 281 } // namespace internal | 281 } // namespace internal |
| 282 } // namespace v8 | 282 } // namespace v8 |
| OLD | NEW |