OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #ifndef V8_PROFILE_GENERATOR_H_ | 5 #ifndef V8_PROFILE_GENERATOR_H_ |
6 #define V8_PROFILE_GENERATOR_H_ | 6 #define V8_PROFILE_GENERATOR_H_ |
7 | 7 |
8 #include "include/v8-profiler.h" | 8 #include "include/v8-profiler.h" |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 public: | 48 public: |
49 // CodeEntry doesn't own name strings, just references them. | 49 // CodeEntry doesn't own name strings, just references them. |
50 inline CodeEntry(Logger::LogEventsAndTags tag, | 50 inline CodeEntry(Logger::LogEventsAndTags tag, |
51 const char* name, | 51 const char* name, |
52 const char* name_prefix = CodeEntry::kEmptyNamePrefix, | 52 const char* name_prefix = CodeEntry::kEmptyNamePrefix, |
53 const char* resource_name = CodeEntry::kEmptyResourceName, | 53 const char* resource_name = CodeEntry::kEmptyResourceName, |
54 int line_number = v8::CpuProfileNode::kNoLineNumberInfo, | 54 int line_number = v8::CpuProfileNode::kNoLineNumberInfo, |
55 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo); | 55 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo); |
56 ~CodeEntry(); | 56 ~CodeEntry(); |
57 | 57 |
58 bool is_js_function() const { return is_js_function_tag(tag_); } | 58 bool is_js_function() const { return is_js_function_tag(tag()); } |
59 const char* name_prefix() const { return name_prefix_; } | 59 const char* name_prefix() const { return name_prefix_; } |
60 bool has_name_prefix() const { return name_prefix_[0] != '\0'; } | 60 bool has_name_prefix() const { return name_prefix_[0] != '\0'; } |
61 const char* name() const { return name_; } | 61 const char* name() const { return name_; } |
62 const char* resource_name() const { return resource_name_; } | 62 const char* resource_name() const { return resource_name_; } |
63 int line_number() const { return line_number_; } | 63 int line_number() const { return line_number_; } |
64 int column_number() const { return column_number_; } | 64 int column_number() const { return column_number_; } |
65 void set_shared_id(int shared_id) { shared_id_ = shared_id; } | 65 void set_shared_id(int shared_id) { shared_id_ = shared_id; } |
66 int script_id() const { return script_id_; } | 66 int script_id() const { return script_id_; } |
67 void set_script_id(int script_id) { script_id_ = script_id; } | 67 void set_script_id(int script_id) { script_id_ = script_id; } |
68 void set_bailout_reason(const char* bailout_reason) { | 68 void set_bailout_reason(const char* bailout_reason) { |
69 bailout_reason_ = bailout_reason; | 69 bailout_reason_ = bailout_reason; |
70 } | 70 } |
71 const char* bailout_reason() const { return bailout_reason_; } | 71 const char* bailout_reason() const { return bailout_reason_; } |
72 | 72 |
73 static inline bool is_js_function_tag(Logger::LogEventsAndTags tag); | 73 static inline bool is_js_function_tag(Logger::LogEventsAndTags tag); |
74 | 74 |
75 List<OffsetRange>* no_frame_ranges() const { return no_frame_ranges_; } | 75 List<OffsetRange>* no_frame_ranges() const { return no_frame_ranges_; } |
76 void set_no_frame_ranges(List<OffsetRange>* ranges) { | 76 void set_no_frame_ranges(List<OffsetRange>* ranges) { |
77 no_frame_ranges_ = ranges; | 77 no_frame_ranges_ = ranges; |
78 } | 78 } |
79 | 79 |
80 void SetBuiltinId(Builtins::Name id); | 80 void SetBuiltinId(Builtins::Name id); |
81 Builtins::Name builtin_id() const { return builtin_id_; } | 81 Builtins::Name builtin_id() const { |
82 return BuiltinIdField::decode(bit_field_); | |
83 } | |
82 | 84 |
83 uint32_t GetCallUid() const; | 85 uint32_t GetCallUid() const; |
84 bool IsSameAs(CodeEntry* entry) const; | 86 bool IsSameAs(CodeEntry* entry) const; |
85 | 87 |
86 static const char* const kEmptyNamePrefix; | 88 static const char* const kEmptyNamePrefix; |
87 static const char* const kEmptyResourceName; | 89 static const char* const kEmptyResourceName; |
88 static const char* const kEmptyBailoutReason; | 90 static const char* const kEmptyBailoutReason; |
89 | 91 |
90 private: | 92 private: |
91 Logger::LogEventsAndTags tag_ : 8; | 93 class TagField : public BitField<Logger::LogEventsAndTags, 0, 8> {}; |
92 Builtins::Name builtin_id_ : 8; | 94 class BuiltinIdField : public BitField<Builtins::Name, 8, 8> {}; |
brucedawson
2014/11/05 01:33:18
Could presumably use typed enums (unsigned char) a
| |
95 Logger::LogEventsAndTags tag() const { return TagField::decode(bit_field_); } | |
96 | |
97 uint32_t bit_field_; | |
93 const char* name_prefix_; | 98 const char* name_prefix_; |
94 const char* name_; | 99 const char* name_; |
95 const char* resource_name_; | 100 const char* resource_name_; |
96 int line_number_; | 101 int line_number_; |
97 int column_number_; | 102 int column_number_; |
98 int shared_id_; | 103 int shared_id_; |
99 int script_id_; | 104 int script_id_; |
100 List<OffsetRange>* no_frame_ranges_; | 105 List<OffsetRange>* no_frame_ranges_; |
101 const char* bailout_reason_; | 106 const char* bailout_reason_; |
102 | 107 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 CodeEntry* gc_entry_; | 334 CodeEntry* gc_entry_; |
330 CodeEntry* unresolved_entry_; | 335 CodeEntry* unresolved_entry_; |
331 | 336 |
332 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); | 337 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); |
333 }; | 338 }; |
334 | 339 |
335 | 340 |
336 } } // namespace v8::internal | 341 } } // namespace v8::internal |
337 | 342 |
338 #endif // V8_PROFILE_GENERATOR_H_ | 343 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |