Line data Source code
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, bool is_shared_cross_origin)
18 629938 : : bit_field_(TagField::encode(tag) |
19 603875 : BuiltinIdField::encode(Builtins::builtin_count) |
20 : SharedCrossOriginField::encode(is_shared_cross_origin)),
21 : name_(name),
22 : resource_name_(resource_name),
23 : line_number_(line_number),
24 : column_number_(column_number),
25 : script_id_(v8::UnboundScript::kNoScriptId),
26 : position_(0),
27 : line_info_(std::move(line_info)),
28 3075456 : instruction_start_(instruction_start) {}
29 :
30 : inline CodeEntry* ProfileGenerator::FindEntry(Address address) {
31 323542 : CodeEntry* entry = code_map_.FindEntry(address);
32 323542 : if (entry) entry->mark_used();
33 : return entry;
34 : }
35 :
36 5820 : ProfileNode::ProfileNode(ProfileTree* tree, CodeEntry* entry,
37 : ProfileNode* parent, int line_number)
38 : : tree_(tree),
39 : entry_(entry),
40 : self_ticks_(0),
41 : line_number_(line_number),
42 : parent_(parent),
43 23280 : id_(tree->next_node_id()) {
44 5820 : tree_->EnqueueNode(this);
45 5820 : }
46 :
47 : inline unsigned ProfileNode::function_id() const {
48 0 : return tree_->GetFunctionId(this);
49 : }
50 :
51 : inline Isolate* ProfileNode::isolate() const { return tree_->isolate(); }
52 :
53 : } // namespace internal
54 : } // namespace v8
55 :
56 : #endif // V8_PROFILER_PROFILE_GENERATOR_INL_H_
|