Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: src/heap-snapshot-generator-inl.h

Issue 12314027: Split profile-generator (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_PROFILE_GENERATOR_INL_H_ 28 #ifndef V8_HEAP_SNAPSHOT_GENERATOR_INL_H_
29 #define V8_PROFILE_GENERATOR_INL_H_ 29 #define V8_HEAP_SNAPSHOT_GENERATOR_INL_H_
30 30
31 #include "profile-generator.h" 31 #include "heap-snapshot-generator.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 const char* StringsStorage::GetFunctionName(String* name) {
37 return GetFunctionName(GetName(name));
38 }
39
40
41 const char* StringsStorage::GetFunctionName(const char* name) {
42 return strlen(name) > 0 ? name : ProfileGenerator::kAnonymousFunctionName;
43 }
44
45
46 CodeEntry::CodeEntry(Logger::LogEventsAndTags tag,
47 const char* name_prefix,
48 const char* name,
49 const char* resource_name,
50 int line_number,
51 int security_token_id)
52 : tag_(tag),
53 name_prefix_(name_prefix),
54 name_(name),
55 resource_name_(resource_name),
56 line_number_(line_number),
57 shared_id_(0),
58 security_token_id_(security_token_id) {
59 }
60
61
62 bool CodeEntry::is_js_function_tag(Logger::LogEventsAndTags tag) {
63 return tag == Logger::FUNCTION_TAG
64 || tag == Logger::LAZY_COMPILE_TAG
65 || tag == Logger::SCRIPT_TAG
66 || tag == Logger::NATIVE_FUNCTION_TAG
67 || tag == Logger::NATIVE_LAZY_COMPILE_TAG
68 || tag == Logger::NATIVE_SCRIPT_TAG;
69 }
70
71
72 ProfileNode::ProfileNode(ProfileTree* tree, CodeEntry* entry)
73 : tree_(tree),
74 entry_(entry),
75 total_ticks_(0),
76 self_ticks_(0),
77 children_(CodeEntriesMatch) {
78 }
79
80
81 CodeEntry* ProfileGenerator::EntryForVMState(StateTag tag) {
82 switch (tag) {
83 case GC:
84 return gc_entry_;
85 case JS:
86 case COMPILER:
87 case PARALLEL_COMPILER:
88 // DOM events handlers are reported as OTHER / EXTERNAL entries.
89 // To avoid confusing people, let's put all these entries into
90 // one bucket.
91 case OTHER:
92 case EXTERNAL:
93 return program_entry_;
94 default: return NULL;
95 }
96 }
97
98 36
99 HeapEntry* HeapGraphEdge::from() const { 37 HeapEntry* HeapGraphEdge::from() const {
100 return &snapshot()->entries()[from_index_]; 38 return &snapshot()->entries()[from_index_];
101 } 39 }
102 40
103 41
104 HeapSnapshot* HeapGraphEdge::snapshot() const { 42 HeapSnapshot* HeapGraphEdge::snapshot() const {
105 return to_entry_->snapshot(); 43 return to_entry_->snapshot();
106 } 44 }
107 45
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 77
140 int V8HeapExplorer::GetGcSubrootOrder(HeapObject* subroot) { 78 int V8HeapExplorer::GetGcSubrootOrder(HeapObject* subroot) {
141 return static_cast<int>( 79 return static_cast<int>(
142 (reinterpret_cast<char*>(subroot) - 80 (reinterpret_cast<char*>(subroot) -
143 reinterpret_cast<char*>(kFirstGcSubrootObject)) / 81 reinterpret_cast<char*>(kFirstGcSubrootObject)) /
144 HeapObjectsMap::kObjectIdStep); 82 HeapObjectsMap::kObjectIdStep);
145 } 83 }
146 84
147 } } // namespace v8::internal 85 } } // namespace v8::internal
148 86
149 #endif // V8_PROFILE_GENERATOR_INL_H_ 87 #endif // V8_HEAP_SNAPSHOT_GENERATOR_INL_H_
88
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698