@@ -2012,18 +2012,18 @@ FILE* Logger::TearDown() {
2012
2012
}
2013
2013
2014
2014
void ExistingCodeLogger::LogCodeObject (Object* object) {
2015
- AbstractCode* code_object = AbstractCode::cast (object);
2015
+ AbstractCode* abstract_code = AbstractCode::cast (object);
2016
2016
CodeEventListener::LogEventsAndTags tag = CodeEventListener::STUB_TAG;
2017
2017
const char * description = " Unknown code from before profiling" ;
2018
- switch (code_object ->kind ()) {
2018
+ switch (abstract_code ->kind ()) {
2019
2019
case AbstractCode::INTERPRETED_FUNCTION:
2020
2020
case AbstractCode::OPTIMIZED_FUNCTION:
2021
2021
return ; // We log this later using LogCompiledFunctions.
2022
2022
case AbstractCode::BYTECODE_HANDLER:
2023
2023
return ; // We log it later by walking the dispatch table.
2024
2024
case AbstractCode::STUB:
2025
2025
description =
2026
- CodeStub::MajorName (CodeStub::GetMajorKey (code_object ->GetCode ()));
2026
+ CodeStub::MajorName (CodeStub::GetMajorKey (abstract_code ->GetCode ()));
2027
2027
if (description == nullptr ) description = " A stub from before profiling" ;
2028
2028
tag = CodeEventListener::STUB_TAG;
2029
2029
break ;
@@ -2032,8 +2032,13 @@ void ExistingCodeLogger::LogCodeObject(Object* object) {
2032
2032
tag = CodeEventListener::REG_EXP_TAG;
2033
2033
break ;
2034
2034
case AbstractCode::BUILTIN:
2035
+ if (Code::cast (object)->is_interpreter_trampoline_builtin () &&
2036
+ Code::cast (object) ==
2037
+ *BUILTIN_CODE (isolate_, InterpreterEntryTrampoline)) {
2038
+ return ;
2039
+ }
2035
2040
description =
2036
- isolate_->builtins ()->name (code_object ->GetCode ()->builtin_index ());
2041
+ isolate_->builtins ()->name (abstract_code ->GetCode ()->builtin_index ());
2037
2042
tag = CodeEventListener::BUILTIN_TAG;
2038
2043
break ;
2039
2044
case AbstractCode::WASM_FUNCTION:
@@ -2059,7 +2064,7 @@ void ExistingCodeLogger::LogCodeObject(Object* object) {
2059
2064
case AbstractCode::NUMBER_OF_KINDS:
2060
2065
UNIMPLEMENTED ();
2061
2066
}
2062
- CALL_CODE_EVENT_HANDLER (CodeCreateEvent (tag, code_object , description))
2067
+ CALL_CODE_EVENT_HANDLER (CodeCreateEvent (tag, abstract_code , description))
2063
2068
}
2064
2069
2065
2070
void ExistingCodeLogger::LogCodeObjects () {
@@ -2085,6 +2090,12 @@ void ExistingCodeLogger::LogCompiledFunctions() {
2085
2090
// During iteration, there can be heap allocation due to
2086
2091
// GetScriptLineNumber call.
2087
2092
for (int i = 0 ; i < compiled_funcs_count; ++i) {
2093
+ if (sfis[i]->function_data ()->IsInterpreterData ()) {
2094
+ LogExistingFunction (sfis[i],
2095
+ Handle <AbstractCode>(AbstractCode::cast (
2096
+ sfis[i]->InterpreterTrampoline ())),
2097
+ CodeEventListener::INTERPRETED_FUNCTION_TAG);
2098
+ }
2088
2099
if (code_objects[i].is_identical_to (BUILTIN_CODE (isolate_, CompileLazy)))
2089
2100
continue ;
2090
2101
LogExistingFunction (sfis[i], code_objects[i]);
@@ -2129,8 +2140,9 @@ void ExistingCodeLogger::LogBytecodeHandlers() {
2129
2140
}
2130
2141
}
2131
2142
2132
- void ExistingCodeLogger::LogExistingFunction (Handle <SharedFunctionInfo> shared,
2133
- Handle <AbstractCode> code) {
2143
+ void ExistingCodeLogger::LogExistingFunction (
2144
+ Handle <SharedFunctionInfo> shared, Handle <AbstractCode> code,
2145
+ CodeEventListener::LogEventsAndTags tag) {
2134
2146
if (shared->script ()->IsScript ()) {
2135
2147
Handle <Script> script (Script::cast (shared->script ()));
2136
2148
int line_num = Script::GetLineNumber (script, shared->StartPosition ()) + 1 ;
@@ -2140,21 +2152,18 @@ void ExistingCodeLogger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
2140
2152
Handle <String> script_name (String::cast (script->name ()));
2141
2153
if (line_num > 0 ) {
2142
2154
CALL_CODE_EVENT_HANDLER (
2143
- CodeCreateEvent (Logger::ToNativeByScript (
2144
- CodeEventListener::LAZY_COMPILE_TAG, *script),
2145
- *code, *shared, *script_name, line_num, column_num))
2155
+ CodeCreateEvent (Logger::ToNativeByScript (tag, *script), *code,
2156
+ *shared, *script_name, line_num, column_num))
2146
2157
} else {
2147
2158
// Can't distinguish eval and script here, so always use Script.
2148
2159
CALL_CODE_EVENT_HANDLER (CodeCreateEvent (
2149
2160
Logger::ToNativeByScript (CodeEventListener::SCRIPT_TAG, *script),
2150
2161
*code, *shared, *script_name))
2151
2162
}
2152
2163
} else {
2153
- CALL_CODE_EVENT_HANDLER (
2154
- CodeCreateEvent (Logger::ToNativeByScript (
2155
- CodeEventListener::LAZY_COMPILE_TAG, *script),
2156
- *code, *shared, isolate_->heap ()->empty_string (),
2157
- line_num, column_num))
2164
+ CALL_CODE_EVENT_HANDLER (CodeCreateEvent (
2165
+ Logger::ToNativeByScript (tag, *script), *code, *shared,
2166
+ isolate_->heap ()->empty_string (), line_num, column_num))
2158
2167
}
2159
2168
} else if (shared->IsApiFunction ()) {
2160
2169
// API function.
@@ -2170,9 +2179,8 @@ void ExistingCodeLogger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
2170
2179
CALL_CODE_EVENT_HANDLER (CallbackEvent (shared->DebugName (), entry_point))
2171
2180
}
2172
2181
} else {
2173
- CALL_CODE_EVENT_HANDLER (CodeCreateEvent (CodeEventListener::LAZY_COMPILE_TAG,
2174
- *code, *shared,
2175
- isolate_->heap ()->empty_string ()))
2182
+ CALL_CODE_EVENT_HANDLER (
2183
+ CodeCreateEvent (tag, *code, *shared, isolate_->heap ()->empty_string ()))
2176
2184
}
2177
2185
}
2178
2186
0 commit comments