blob: ac23ee3f01195be14df4de15c951ac1f030a98ee [file] [log] [blame]
fschneider@chromium.org086aac62010-03-17 13:18:24 +00001// Copyright 2010 the V8 project authors. All rights reserved.
2// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
27
28#ifndef V8_PROFILE_GENERATOR_INL_H_
29#define V8_PROFILE_GENERATOR_INL_H_
30
31#include "profile-generator.h"
32
33namespace v8 {
34namespace internal {
35
ulan@chromium.org750145a2013-03-07 15:14:13 +000036const char* StringsStorage::GetFunctionName(Name* name) {
erik.corry@gmail.com145eff52010-08-23 11:36:18 +000037 return GetFunctionName(GetName(name));
38}
39
40
41const char* StringsStorage::GetFunctionName(const char* name) {
42 return strlen(name) > 0 ? name : ProfileGenerator::kAnonymousFunctionName;
43}
44
45
whesse@chromium.orgcec079d2010-03-22 14:44:04 +000046CodeEntry::CodeEntry(Logger::LogEventsAndTags tag,
47 const char* name,
jkummerow@chromium.org93a47f42013-07-02 14:43:41 +000048 const char* name_prefix,
whesse@chromium.orgcec079d2010-03-22 14:44:04 +000049 const char* resource_name,
mvstanton@chromium.orgdd6d9ee2013-10-11 10:35:37 +000050 int line_number,
51 int column_number)
fschneider@chromium.orgc20610a2010-09-22 09:44:58 +000052 : tag_(tag),
jkummerow@chromium.org93a47f42013-07-02 14:43:41 +000053 builtin_id_(Builtins::builtin_count),
lrn@chromium.org25156de2010-04-06 13:10:27 +000054 name_prefix_(name_prefix),
whesse@chromium.orgcec079d2010-03-22 14:44:04 +000055 name_(name),
56 resource_name_(resource_name),
erik.corry@gmail.com9dfbea42010-05-21 12:58:28 +000057 line_number_(line_number),
mvstanton@chromium.orgdd6d9ee2013-10-11 10:35:37 +000058 column_number_(column_number),
fschneider@chromium.org3a5fd782011-02-24 10:10:44 +000059 shared_id_(0),
jkummerow@chromium.org93a47f42013-07-02 14:43:41 +000060 script_id_(v8::Script::kNoScriptId),
jkummerow@chromium.org2c9426b2013-09-05 16:31:13 +000061 no_frame_ranges_(NULL),
62 bailout_reason_(kEmptyBailoutReason) { }
whesse@chromium.orgcec079d2010-03-22 14:44:04 +000063
64
ager@chromium.org357bf652010-04-12 11:30:10 +000065bool CodeEntry::is_js_function_tag(Logger::LogEventsAndTags tag) {
66 return tag == Logger::FUNCTION_TAG
67 || tag == Logger::LAZY_COMPILE_TAG
68 || tag == Logger::SCRIPT_TAG
69 || tag == Logger::NATIVE_FUNCTION_TAG
70 || tag == Logger::NATIVE_LAZY_COMPILE_TAG
71 || tag == Logger::NATIVE_SCRIPT_TAG;
fschneider@chromium.org086aac62010-03-17 13:18:24 +000072}
73
74
ricow@chromium.orgc9c80822010-04-21 08:22:37 +000075ProfileNode::ProfileNode(ProfileTree* tree, CodeEntry* entry)
76 : tree_(tree),
77 entry_(entry),
fschneider@chromium.org086aac62010-03-17 13:18:24 +000078 self_ticks_(0),
mstarzinger@chromium.orgf705b502013-04-04 11:38:09 +000079 children_(CodeEntriesMatch),
jkummerow@chromium.org2c9426b2013-09-05 16:31:13 +000080 id_(tree->next_node_id()) { }
fschneider@chromium.org086aac62010-03-17 13:18:24 +000081
fschneider@chromium.org086aac62010-03-17 13:18:24 +000082} } // namespace v8::internal
83
fschneider@chromium.org086aac62010-03-17 13:18:24 +000084#endif // V8_PROFILE_GENERATOR_INL_H_