@@ -2012,18 +2012,18 @@ FILE* Logger::TearDown(){
20122012}
20132013
20142014void ExistingCodeLogger::LogCodeObject (Object* object){
2015- AbstractCode* code_object = AbstractCode::cast (object);
2015+ AbstractCode* abstract_code = AbstractCode::cast (object);
20162016 CodeEventListener::LogEventsAndTags tag = CodeEventListener::STUB_TAG;
20172017const char * description = " Unknown code from before profiling" ;
2018- switch (code_object ->kind ()){
2018+ switch (abstract_code ->kind ()){
20192019case AbstractCode::INTERPRETED_FUNCTION:
20202020case AbstractCode::OPTIMIZED_FUNCTION:
20212021return ; // We log this later using LogCompiledFunctions.
20222022case AbstractCode::BYTECODE_HANDLER:
20232023return ; // We log it later by walking the dispatch table.
20242024case AbstractCode::STUB:
20252025 description =
2026- CodeStub::MajorName (CodeStub::GetMajorKey (code_object ->GetCode ()));
2026+ CodeStub::MajorName (CodeStub::GetMajorKey (abstract_code ->GetCode ()));
20272027if (description == nullptr ) description = " A stub from before profiling" ;
20282028 tag = CodeEventListener::STUB_TAG;
20292029break ;
@@ -2032,8 +2032,13 @@ void ExistingCodeLogger::LogCodeObject(Object* object){
20322032 tag = CodeEventListener::REG_EXP_TAG;
20332033break ;
20342034case AbstractCode::BUILTIN:
2035+ if (Code::cast (object)->is_interpreter_trampoline_builtin () &&
2036+ Code::cast (object) ==
2037+ *BUILTIN_CODE (isolate_, InterpreterEntryTrampoline)){
2038+ return ;
2039+ }
20352040 description =
2036- isolate_->builtins ()->name (code_object ->GetCode ()->builtin_index ());
2041+ isolate_->builtins ()->name (abstract_code ->GetCode ()->builtin_index ());
20372042 tag = CodeEventListener::BUILTIN_TAG;
20382043break ;
20392044case AbstractCode::WASM_FUNCTION:
@@ -2059,7 +2064,7 @@ void ExistingCodeLogger::LogCodeObject(Object* object){
20592064case AbstractCode::NUMBER_OF_KINDS:
20602065UNIMPLEMENTED ();
20612066 }
2062- CALL_CODE_EVENT_HANDLER (CodeCreateEvent (tag, code_object , description))
2067+ CALL_CODE_EVENT_HANDLER (CodeCreateEvent (tag, abstract_code , description))
20632068}
20642069
20652070void ExistingCodeLogger::LogCodeObjects (){
@@ -2085,6 +2090,12 @@ void ExistingCodeLogger::LogCompiledFunctions(){
20852090// During iteration, there can be heap allocation due to
20862091// GetScriptLineNumber call.
20872092for (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+ }
20882099if (code_objects[i].is_identical_to (BUILTIN_CODE (isolate_, CompileLazy)))
20892100continue ;
20902101LogExistingFunction (sfis[i], code_objects[i]);
@@ -2129,8 +2140,9 @@ void ExistingCodeLogger::LogBytecodeHandlers(){
21292140 }
21302141}
21312142
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){
21342146if (shared->script ()->IsScript ()){
21352147 Handle<Script> script (Script::cast (shared->script ()));
21362148int line_num = Script::GetLineNumber (script, shared->StartPosition ()) + 1 ;
@@ -2140,21 +2152,18 @@ void ExistingCodeLogger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
21402152 Handle<String> script_name (String::cast (script->name ()));
21412153if (line_num > 0 ){
21422154CALL_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))
21462157 } else {
21472158// Can't distinguish eval and script here, so always use Script.
21482159CALL_CODE_EVENT_HANDLER (CodeCreateEvent (
21492160Logger::ToNativeByScript (CodeEventListener::SCRIPT_TAG, *script),
21502161 *code, *shared, *script_name))
21512162 }
21522163 } 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))
21582167 }
21592168 } else if (shared->IsApiFunction ()){
21602169// API function.
@@ -2170,9 +2179,8 @@ void ExistingCodeLogger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
21702179CALL_CODE_EVENT_HANDLER (CallbackEvent (shared->DebugName (), entry_point))
21712180 }
21722181 } 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 ()))
21762184 }
21772185}
21782186
0 commit comments