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 #include <memory>
11
12 namespace v8 {
13 namespace internal {
14
CodeEntry(CodeEventListener::LogEventsAndTags tag,const char * name,const char * resource_name,int line_number,int column_number,std::unique_ptr<SourcePositionTable> line_info,bool is_shared_cross_origin,CodeType code_type)15 CodeEntry::CodeEntry(CodeEventListener::LogEventsAndTags tag, const char* name,
16 const char* resource_name, int line_number,
17 int column_number,
18 std::unique_ptr<SourcePositionTable> line_info,
19 bool is_shared_cross_origin, CodeType code_type)
20 : bit_field_(TagField::encode(tag) |
21 BuiltinField::encode(Builtin::kIllegal) |
22 CodeTypeField::encode(code_type) |
23 SharedCrossOriginField::encode(is_shared_cross_origin)),
24 name_(name),
25 resource_name_(resource_name),
26 line_number_(line_number),
27 column_number_(column_number),
28 script_id_(v8::UnboundScript::kNoScriptId),
29 position_(0),
30 line_info_(std::move(line_info)) {}
31
ProfileNode(ProfileTree * tree,CodeEntry * entry,ProfileNode * parent,int line_number)32 ProfileNode::ProfileNode(ProfileTree* tree, CodeEntry* entry,
33 ProfileNode* parent, int line_number)
34 : tree_(tree),
35 entry_(entry),
36 self_ticks_(0),
37 line_number_(line_number),
38 parent_(parent),
39 id_(tree->next_node_id()) {
40 tree_->EnqueueNode(this);
41 if (tree_->code_entries()) tree_->code_entries()->AddRef(entry_);
42 }
43
isolate()44 inline Isolate* ProfileNode::isolate() const { return tree_->isolate(); }
45
46 } // namespace internal
47 } // namespace v8
48
49 #endif // V8_PROFILER_PROFILE_GENERATOR_INL_H_
50