Home | History | Annotate | Download | only in profiler
      1 // Copyright 2010 the V8 project authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef V8_PROFILER_PROFILE_GENERATOR_INL_H_
      6 #define V8_PROFILER_PROFILE_GENERATOR_INL_H_
      7 
      8 #include "src/profiler/profile-generator.h"
      9 
     10 namespace v8 {
     11 namespace internal {
     12 
     13 CodeEntry::CodeEntry(CodeEventListener::LogEventsAndTags tag, const char* name,
     14                      const char* resource_name, int line_number,
     15                      int column_number,
     16                      std::unique_ptr<SourcePositionTable> line_info,
     17                      Address instruction_start)
     18     : bit_field_(TagField::encode(tag) |
     19                  BuiltinIdField::encode(Builtins::builtin_count)),
     20       name_(name),
     21       resource_name_(resource_name),
     22       line_number_(line_number),
     23       column_number_(column_number),
     24       script_id_(v8::UnboundScript::kNoScriptId),
     25       position_(0),
     26       line_info_(std::move(line_info)),
     27       instruction_start_(instruction_start) {}
     28 
     29 inline CodeEntry* ProfileGenerator::FindEntry(Address address) {
     30   CodeEntry* entry = code_map_.FindEntry(address);
     31   if (entry) entry->mark_used();
     32   return entry;
     33 }
     34 
     35 ProfileNode::ProfileNode(ProfileTree* tree, CodeEntry* entry,
     36                          ProfileNode* parent, int line_number)
     37     : tree_(tree),
     38       entry_(entry),
     39       self_ticks_(0),
     40       line_number_(line_number),
     41       parent_(parent),
     42       id_(tree->next_node_id()) {
     43   tree_->EnqueueNode(this);
     44 }
     45 
     46 inline unsigned ProfileNode::function_id() const {
     47   return tree_->GetFunctionId(this);
     48 }
     49 
     50 inline Isolate* ProfileNode::isolate() const { return tree_->isolate(); }
     51 
     52 }  // namespace internal
     53 }  // namespace v8
     54 
     55 #endif  // V8_PROFILER_PROFILE_GENERATOR_INL_H_
     56