@@ -2011,18 +2011,18 @@ FILE* Logger::TearDown() {
20112011}
20122012
20132013void ExistingCodeLogger::LogCodeObject (Object* object) {
2014- AbstractCode* code_object = AbstractCode::cast (object);
2014+ AbstractCode* abstract_code = AbstractCode::cast (object);
20152015 CodeEventListener::LogEventsAndTags tag = CodeEventListener::STUB_TAG;
20162016 const char * description = " Unknown code from before profiling" ;
2017- switch (code_object ->kind ()) {
2017+ switch (abstract_code ->kind ()) {
20182018 case AbstractCode::INTERPRETED_FUNCTION:
20192019 case AbstractCode::OPTIMIZED_FUNCTION:
20202020 return ; // We log this later using LogCompiledFunctions.
20212021 case AbstractCode::BYTECODE_HANDLER:
20222022 return ; // We log it later by walking the dispatch table.
20232023 case AbstractCode::STUB:
20242024 description =
2025- CodeStub::MajorName (CodeStub::GetMajorKey (code_object ->GetCode ()));
2025+ CodeStub::MajorName (CodeStub::GetMajorKey (abstract_code ->GetCode ()));
20262026 if (description == nullptr ) description = " A stub from before profiling" ;
20272027 tag = CodeEventListener::STUB_TAG;
20282028 break ;
@@ -2031,8 +2031,13 @@ void ExistingCodeLogger::LogCodeObject(Object* object) {
20312031 tag = CodeEventListener::REG_EXP_TAG;
20322032 break ;
20332033 case AbstractCode::BUILTIN:
2034+ if (Code::cast (object)->is_interpreter_trampoline_builtin () &&
2035+ Code::cast (object) ==
2036+ *BUILTIN_CODE (isolate_, InterpreterEntryTrampoline)) {
2037+ return ;
2038+ }
20342039 description =
2035- isolate_->builtins ()->name (code_object ->GetCode ()->builtin_index ());
2040+ isolate_->builtins ()->name (abstract_code ->GetCode ()->builtin_index ());
20362041 tag = CodeEventListener::BUILTIN_TAG;
20372042 break ;
20382043 case AbstractCode::WASM_FUNCTION:
@@ -2058,7 +2063,7 @@ void ExistingCodeLogger::LogCodeObject(Object* object) {
20582063 case AbstractCode::NUMBER_OF_KINDS:
20592064 UNIMPLEMENTED ();
20602065 }
2061- CALL_CODE_EVENT_HANDLER (CodeCreateEvent (tag, code_object , description))
2066+ CALL_CODE_EVENT_HANDLER (CodeCreateEvent (tag, abstract_code , description))
20622067}
20632068
20642069void ExistingCodeLogger::LogCodeObjects () {
@@ -2084,6 +2089,12 @@ void ExistingCodeLogger::LogCompiledFunctions() {
20842089 // During iteration, there can be heap allocation due to
20852090 // GetScriptLineNumber call.
20862091 for (int i = 0 ; i < compiled_funcs_count; ++i) {
2092+ if (sfis[i]->function_data ()->IsInterpreterData ()) {
2093+ LogExistingFunction (sfis[i],
2094+ Handle<AbstractCode>(AbstractCode::cast (
2095+ sfis[i]->InterpreterTrampoline ())),
2096+ CodeEventListener::INTERPRETED_FUNCTION_TAG);
2097+ }
20872098 if (code_objects[i].is_identical_to (BUILTIN_CODE (isolate_, CompileLazy)))
20882099 continue ;
20892100 LogExistingFunction (sfis[i], code_objects[i]);
@@ -2128,8 +2139,9 @@ void ExistingCodeLogger::LogBytecodeHandlers() {
21282139 }
21292140}
21302141
2131- void ExistingCodeLogger::LogExistingFunction (Handle<SharedFunctionInfo> shared,
2132- Handle<AbstractCode> code) {
2142+ void ExistingCodeLogger::LogExistingFunction (
2143+ Handle<SharedFunctionInfo> shared, Handle<AbstractCode> code,
2144+ CodeEventListener::LogEventsAndTags tag) {
21332145 if (shared->script ()->IsScript ()) {
21342146 Handle<Script> script (Script::cast (shared->script ()));
21352147 int line_num = Script::GetLineNumber (script, shared->StartPosition ()) + 1 ;
@@ -2139,21 +2151,18 @@ void ExistingCodeLogger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
21392151 Handle<String> script_name (String::cast (script->name ()));
21402152 if (line_num > 0 ) {
21412153 CALL_CODE_EVENT_HANDLER (
2142- CodeCreateEvent (Logger::ToNativeByScript (
2143- CodeEventListener::LAZY_COMPILE_TAG, *script),
2144- *code, *shared, *script_name, line_num, column_num))
2154+ CodeCreateEvent (Logger::ToNativeByScript (tag, *script), *code,
2155+ *shared, *script_name, line_num, column_num))
21452156 } else {
21462157 // Can't distinguish eval and script here, so always use Script.
21472158 CALL_CODE_EVENT_HANDLER (CodeCreateEvent (
21482159 Logger::ToNativeByScript (CodeEventListener::SCRIPT_TAG, *script),
21492160 *code, *shared, *script_name))
21502161 }
21512162 } else {
2152- CALL_CODE_EVENT_HANDLER (
2153- CodeCreateEvent (Logger::ToNativeByScript (
2154- CodeEventListener::LAZY_COMPILE_TAG, *script),
2155- *code, *shared, isolate_->heap ()->empty_string (),
2156- line_num, column_num))
2163+ CALL_CODE_EVENT_HANDLER (CodeCreateEvent (
2164+ Logger::ToNativeByScript (tag, *script), *code, *shared,
2165+ isolate_->heap ()->empty_string (), line_num, column_num))
21572166 }
21582167 } else if (shared->IsApiFunction ()) {
21592168 // API function.
@@ -2169,9 +2178,8 @@ void ExistingCodeLogger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
21692178 CALL_CODE_EVENT_HANDLER (CallbackEvent (shared->DebugName (), entry_point))
21702179 }
21712180 } else {
2172- CALL_CODE_EVENT_HANDLER (CodeCreateEvent (CodeEventListener::LAZY_COMPILE_TAG,
2173- *code, *shared,
2174- isolate_->heap ()->empty_string ()))
2181+ CALL_CODE_EVENT_HANDLER (
2182+ CodeCreateEvent (tag, *code, *shared, isolate_->heap ()->empty_string ()))
21752183 }
21762184}
21772185
0 commit comments