@@ -2031,18 +2031,18 @@ FILE* Logger::TearDown() {
2031
2031
}
2032
2032
2033
2033
void ExistingCodeLogger::LogCodeObject (Object* object) {
2034
- AbstractCode* code_object = AbstractCode::cast (object);
2034
+ AbstractCode* abstract_code = AbstractCode::cast (object);
2035
2035
CodeEventListener::LogEventsAndTags tag = CodeEventListener::STUB_TAG;
2036
2036
const char * description = " Unknown code from before profiling" ;
2037
- switch (code_object ->kind ()) {
2037
+ switch (abstract_code ->kind ()) {
2038
2038
case AbstractCode::INTERPRETED_FUNCTION:
2039
2039
case AbstractCode::OPTIMIZED_FUNCTION:
2040
2040
return ; // We log this later using LogCompiledFunctions.
2041
2041
case AbstractCode::BYTECODE_HANDLER:
2042
2042
return ; // We log it later by walking the dispatch table.
2043
2043
case AbstractCode::STUB:
2044
2044
description =
2045
- CodeStub::MajorName (CodeStub::GetMajorKey (code_object ->GetCode ()));
2045
+ CodeStub::MajorName (CodeStub::GetMajorKey (abstract_code ->GetCode ()));
2046
2046
if (description == nullptr ) description = " A stub from before profiling" ;
2047
2047
tag = CodeEventListener::STUB_TAG;
2048
2048
break ;
@@ -2051,8 +2051,13 @@ void ExistingCodeLogger::LogCodeObject(Object* object) {
2051
2051
tag = CodeEventListener::REG_EXP_TAG;
2052
2052
break ;
2053
2053
case AbstractCode::BUILTIN:
2054
+ if (Code::cast (object)->is_interpreter_trampoline_builtin () &&
2055
+ Code::cast (object) ==
2056
+ *BUILTIN_CODE (isolate_, InterpreterEntryTrampoline)) {
2057
+ return ;
2058
+ }
2054
2059
description =
2055
- isolate_->builtins ()->name (code_object ->GetCode ()->builtin_index ());
2060
+ isolate_->builtins ()->name (abstract_code ->GetCode ()->builtin_index ());
2056
2061
tag = CodeEventListener::BUILTIN_TAG;
2057
2062
break ;
2058
2063
case AbstractCode::WASM_FUNCTION:
@@ -2078,7 +2083,7 @@ void ExistingCodeLogger::LogCodeObject(Object* object) {
2078
2083
case AbstractCode::NUMBER_OF_KINDS:
2079
2084
UNIMPLEMENTED ();
2080
2085
}
2081
- CALL_CODE_EVENT_HANDLER (CodeCreateEvent (tag, code_object , description))
2086
+ CALL_CODE_EVENT_HANDLER (CodeCreateEvent (tag, abstract_code , description))
2082
2087
}
2083
2088
2084
2089
void ExistingCodeLogger::LogCodeObjects () {
@@ -2104,6 +2109,12 @@ void ExistingCodeLogger::LogCompiledFunctions() {
2104
2109
// During iteration, there can be heap allocation due to
2105
2110
// GetScriptLineNumber call.
2106
2111
for (int i = 0 ; i < compiled_funcs_count; ++i) {
2112
+ if (sfis[i]->function_data ()->IsInterpreterData ()) {
2113
+ LogExistingFunction (sfis[i],
2114
+ Handle <AbstractCode>(AbstractCode::cast (
2115
+ sfis[i]->InterpreterTrampoline ())),
2116
+ CodeEventListener::INTERPRETED_FUNCTION_TAG);
2117
+ }
2107
2118
if (code_objects[i].is_identical_to (BUILTIN_CODE (isolate_, CompileLazy)))
2108
2119
continue ;
2109
2120
LogExistingFunction (sfis[i], code_objects[i]);
@@ -2148,8 +2159,9 @@ void ExistingCodeLogger::LogBytecodeHandlers() {
2148
2159
}
2149
2160
}
2150
2161
2151
- void ExistingCodeLogger::LogExistingFunction (Handle <SharedFunctionInfo> shared,
2152
- Handle <AbstractCode> code) {
2162
+ void ExistingCodeLogger::LogExistingFunction (
2163
+ Handle <SharedFunctionInfo> shared, Handle <AbstractCode> code,
2164
+ CodeEventListener::LogEventsAndTags tag) {
2153
2165
if (shared->script ()->IsScript ()) {
2154
2166
Handle <Script> script (Script::cast (shared->script ()));
2155
2167
int line_num = Script::GetLineNumber (script, shared->StartPosition ()) + 1 ;
@@ -2159,21 +2171,18 @@ void ExistingCodeLogger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
2159
2171
Handle <String> script_name (String::cast (script->name ()));
2160
2172
if (line_num > 0 ) {
2161
2173
CALL_CODE_EVENT_HANDLER (
2162
- CodeCreateEvent (Logger::ToNativeByScript (
2163
- CodeEventListener::LAZY_COMPILE_TAG, *script),
2164
- *code, *shared, *script_name, line_num, column_num))
2174
+ CodeCreateEvent (Logger::ToNativeByScript (tag, *script), *code,
2175
+ *shared, *script_name, line_num, column_num))
2165
2176
} else {
2166
2177
// Can't distinguish eval and script here, so always use Script.
2167
2178
CALL_CODE_EVENT_HANDLER (CodeCreateEvent (
2168
2179
Logger::ToNativeByScript (CodeEventListener::SCRIPT_TAG, *script),
2169
2180
*code, *shared, *script_name))
2170
2181
}
2171
2182
} else {
2172
- CALL_CODE_EVENT_HANDLER (
2173
- CodeCreateEvent (Logger::ToNativeByScript (
2174
- CodeEventListener::LAZY_COMPILE_TAG, *script),
2175
- *code, *shared, isolate_->heap ()->empty_string (),
2176
- line_num, column_num))
2183
+ CALL_CODE_EVENT_HANDLER (CodeCreateEvent (
2184
+ Logger::ToNativeByScript (tag, *script), *code, *shared,
2185
+ isolate_->heap ()->empty_string (), line_num, column_num))
2177
2186
}
2178
2187
} else if (shared->IsApiFunction ()) {
2179
2188
// API function.
@@ -2189,9 +2198,8 @@ void ExistingCodeLogger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
2189
2198
CALL_CODE_EVENT_HANDLER (CallbackEvent (shared->DebugName (), entry_point))
2190
2199
}
2191
2200
} else {
2192
- CALL_CODE_EVENT_HANDLER (CodeCreateEvent (CodeEventListener::LAZY_COMPILE_TAG,
2193
- *code, *shared,
2194
- isolate_->heap ()->empty_string ()))
2201
+ CALL_CODE_EVENT_HANDLER (
2202
+ CodeCreateEvent (tag, *code, *shared, isolate_->heap ()->empty_string ()))
2195
2203
}
2196
2204
}
2197
2205
0 commit comments