@@ -2031,18 +2031,18 @@ FILE* Logger::TearDown() {
20312031}
20322032
20332033void ExistingCodeLogger::LogCodeObject (Object* object) {
2034- AbstractCode* code_object = AbstractCode::cast (object);
2034+ AbstractCode* abstract_code = AbstractCode::cast (object);
20352035 CodeEventListener::LogEventsAndTags tag = CodeEventListener::STUB_TAG;
20362036 const char * description = " Unknown code from before profiling" ;
2037- switch (code_object ->kind ()) {
2037+ switch (abstract_code ->kind ()) {
20382038 case AbstractCode::INTERPRETED_FUNCTION:
20392039 case AbstractCode::OPTIMIZED_FUNCTION:
20402040 return ; // We log this later using LogCompiledFunctions.
20412041 case AbstractCode::BYTECODE_HANDLER:
20422042 return ; // We log it later by walking the dispatch table.
20432043 case AbstractCode::STUB:
20442044 description =
2045- CodeStub::MajorName (CodeStub::GetMajorKey (code_object ->GetCode ()));
2045+ CodeStub::MajorName (CodeStub::GetMajorKey (abstract_code ->GetCode ()));
20462046 if (description == nullptr ) description = " A stub from before profiling" ;
20472047 tag = CodeEventListener::STUB_TAG;
20482048 break ;
@@ -2051,8 +2051,13 @@ void ExistingCodeLogger::LogCodeObject(Object* object) {
20512051 tag = CodeEventListener::REG_EXP_TAG;
20522052 break ;
20532053 case AbstractCode::BUILTIN:
2054+ if (Code::cast (object)->is_interpreter_trampoline_builtin () &&
2055+ Code::cast (object) ==
2056+ *BUILTIN_CODE (isolate_, InterpreterEntryTrampoline)) {
2057+ return ;
2058+ }
20542059 description =
2055- isolate_->builtins ()->name (code_object ->GetCode ()->builtin_index ());
2060+ isolate_->builtins ()->name (abstract_code ->GetCode ()->builtin_index ());
20562061 tag = CodeEventListener::BUILTIN_TAG;
20572062 break ;
20582063 case AbstractCode::WASM_FUNCTION:
@@ -2078,7 +2083,7 @@ void ExistingCodeLogger::LogCodeObject(Object* object) {
20782083 case AbstractCode::NUMBER_OF_KINDS:
20792084 UNIMPLEMENTED ();
20802085 }
2081- CALL_CODE_EVENT_HANDLER (CodeCreateEvent (tag, code_object , description))
2086+ CALL_CODE_EVENT_HANDLER (CodeCreateEvent (tag, abstract_code , description))
20822087}
20832088
20842089void ExistingCodeLogger::LogCodeObjects () {
@@ -2104,6 +2109,12 @@ void ExistingCodeLogger::LogCompiledFunctions() {
21042109 // During iteration, there can be heap allocation due to
21052110 // GetScriptLineNumber call.
21062111 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+ }
21072118 if (code_objects[i].is_identical_to (BUILTIN_CODE (isolate_, CompileLazy)))
21082119 continue ;
21092120 LogExistingFunction (sfis[i], code_objects[i]);
@@ -2148,8 +2159,9 @@ void ExistingCodeLogger::LogBytecodeHandlers() {
21482159 }
21492160}
21502161
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) {
21532165 if (shared->script ()->IsScript ()) {
21542166 Handle<Script> script (Script::cast (shared->script ()));
21552167 int line_num = Script::GetLineNumber (script, shared->StartPosition ()) + 1 ;
@@ -2159,21 +2171,18 @@ void ExistingCodeLogger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
21592171 Handle<String> script_name (String::cast (script->name ()));
21602172 if (line_num > 0 ) {
21612173 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))
21652176 } else {
21662177 // Can't distinguish eval and script here, so always use Script.
21672178 CALL_CODE_EVENT_HANDLER (CodeCreateEvent (
21682179 Logger::ToNativeByScript (CodeEventListener::SCRIPT_TAG, *script),
21692180 *code, *shared, *script_name))
21702181 }
21712182 } 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))
21772186 }
21782187 } else if (shared->IsApiFunction ()) {
21792188 // API function.
@@ -2189,9 +2198,8 @@ void ExistingCodeLogger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
21892198 CALL_CODE_EVENT_HANDLER (CallbackEvent (shared->DebugName (), entry_point))
21902199 }
21912200 } 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 ()))
21952203 }
21962204}
21972205
0 commit comments