Chromium Code Reviews| Index: src/log.cc |
| diff --git a/src/log.cc b/src/log.cc |
| index 1c0f011332c9e65d4470d0abfe8c82253097300b..0cd6230812e3be93c453eecb688fdf72d3671345 100644 |
| --- a/src/log.cc |
| +++ b/src/log.cc |
| @@ -45,11 +45,13 @@ for (int i = 0; i < listeners_.length(); ++i) { \ |
| } \ |
| } while (false); |
| -static const char* ComputeMarker(SharedFunctionInfo* shared, Code* code) { |
| +static const char* ComputeMarker(SharedFunctionInfo* shared, |
| + AbstractCode* code) { |
| switch (code->kind()) { |
| - case Code::FUNCTION: |
| + case AbstractCode::FUNCTION: |
| + case AbstractCode::INTERPRETED_FUNCTION: |
| return shared->optimization_disabled() ? "" : "~"; |
| - case Code::OPTIMIZED_FUNCTION: |
| + case AbstractCode::OPTIMIZED_FUNCTION: |
| return "*"; |
| default: |
| return ""; |
| @@ -159,42 +161,35 @@ CodeEventLogger::CodeEventLogger() : name_buffer_(new NameBuffer) { } |
| CodeEventLogger::~CodeEventLogger() { delete name_buffer_; } |
| - |
| void CodeEventLogger::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| - Code* code, |
| - const char* comment) { |
| + AbstractCode* code, const char* comment) { |
| name_buffer_->Init(tag); |
| name_buffer_->AppendBytes(comment); |
| LogRecordedBuffer(code, NULL, name_buffer_->get(), name_buffer_->size()); |
| } |
| - |
| void CodeEventLogger::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| - Code* code, |
| - Name* name) { |
| + AbstractCode* code, Name* name) { |
| name_buffer_->Init(tag); |
| name_buffer_->AppendName(name); |
| LogRecordedBuffer(code, NULL, name_buffer_->get(), name_buffer_->size()); |
| } |
| - |
| void CodeEventLogger::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| - Code* code, |
| + AbstractCode* code, |
| SharedFunctionInfo* shared, |
| - CompilationInfo* info, |
| - Name* name) { |
| + CompilationInfo* info, Name* name) { |
| name_buffer_->Init(tag); |
| name_buffer_->AppendBytes(ComputeMarker(shared, code)); |
| name_buffer_->AppendName(name); |
| LogRecordedBuffer(code, shared, name_buffer_->get(), name_buffer_->size()); |
| } |
| - |
| void CodeEventLogger::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| - Code* code, |
| + AbstractCode* code, |
| SharedFunctionInfo* shared, |
| - CompilationInfo* info, |
| - Name* source, int line, int column) { |
| + CompilationInfo* info, Name* source, |
| + int line, int column) { |
| name_buffer_->Init(tag); |
| name_buffer_->AppendBytes(ComputeMarker(shared, code)); |
| name_buffer_->AppendString(shared->DebugName()); |
| @@ -211,17 +206,15 @@ void CodeEventLogger::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| LogRecordedBuffer(code, shared, name_buffer_->get(), name_buffer_->size()); |
| } |
| - |
| void CodeEventLogger::CodeCreateEvent(Logger::LogEventsAndTags tag, |
| - Code* code, |
| - int args_count) { |
| + AbstractCode* code, int args_count) { |
| name_buffer_->Init(tag); |
| name_buffer_->AppendInt(args_count); |
| LogRecordedBuffer(code, NULL, name_buffer_->get(), name_buffer_->size()); |
| } |
| - |
| -void CodeEventLogger::RegExpCodeCreateEvent(Code* code, String* source) { |
| +void CodeEventLogger::RegExpCodeCreateEvent(AbstractCode* code, |
| + String* source) { |
| name_buffer_->Init(Logger::REG_EXP_TAG); |
| name_buffer_->AppendString(source); |
| LogRecordedBuffer(code, NULL, name_buffer_->get(), name_buffer_->size()); |
| @@ -232,17 +225,15 @@ void CodeEventLogger::RegExpCodeCreateEvent(Code* code, String* source) { |
| class PerfBasicLogger : public CodeEventLogger { |
| public: |
| PerfBasicLogger(); |
| - virtual ~PerfBasicLogger(); |
| + ~PerfBasicLogger() override; |
| - virtual void CodeMoveEvent(Address from, Address to) { } |
| - virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) { } |
| - virtual void CodeDeleteEvent(Address from) { } |
| + void CodeMoveEvent(AbstractCode* from, Address to) override {} |
| + void CodeDisableOptEvent(AbstractCode* code, |
| + SharedFunctionInfo* shared) override {} |
| private: |
| - virtual void LogRecordedBuffer(Code* code, |
| - SharedFunctionInfo* shared, |
| - const char* name, |
| - int length); |
| + void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared, |
| + const char* name, int length) override; |
| // Extension added to V8 log file name to get the low-level log name. |
| static const char kFilenameFormatString[]; |
| @@ -281,16 +272,12 @@ PerfBasicLogger::~PerfBasicLogger() { |
| perf_output_handle_ = NULL; |
| } |
| - |
| -void PerfBasicLogger::LogRecordedBuffer(Code* code, |
| - SharedFunctionInfo*, |
| - const char* name, |
| - int length) { |
| - DCHECK(code->instruction_start() == code->address() + Code::kHeaderSize); |
| - |
| +void PerfBasicLogger::LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo*, |
| + const char* name, int length) { |
| if (FLAG_perf_basic_prof_only_functions && |
| - (code->kind() != Code::FUNCTION && |
| - code->kind() != Code::OPTIMIZED_FUNCTION)) { |
| + (code->kind() != AbstractCode::FUNCTION && |
| + code->kind() != AbstractCode::INTERPRETED_FUNCTION && |
| + code->kind() != AbstractCode::OPTIMIZED_FUNCTION)) { |
| return; |
| } |
| @@ -306,19 +293,17 @@ void PerfBasicLogger::LogRecordedBuffer(Code* code, |
| class LowLevelLogger : public CodeEventLogger { |
| public: |
| explicit LowLevelLogger(const char* file_name); |
| - virtual ~LowLevelLogger(); |
| + ~LowLevelLogger() override; |
| - virtual void CodeMoveEvent(Address from, Address to); |
| - virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) { } |
| - virtual void CodeDeleteEvent(Address from); |
| - virtual void SnapshotPositionEvent(Address addr, int pos); |
| - virtual void CodeMovingGCEvent(); |
| + void CodeMoveEvent(AbstractCode* from, Address to) override; |
| + void CodeDisableOptEvent(AbstractCode* code, |
| + SharedFunctionInfo* shared) override {} |
| + void SnapshotPositionEvent(Address addr, int pos); |
| + void CodeMovingGCEvent() override; |
| private: |
| - virtual void LogRecordedBuffer(Code* code, |
| - SharedFunctionInfo* shared, |
| - const char* name, |
| - int length); |
| + void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared, |
| + const char* name, int length) override; |
| // Low-level profiling event structures. |
| struct CodeCreateStruct { |
| @@ -338,13 +323,6 @@ class LowLevelLogger : public CodeEventLogger { |
| }; |
| - struct CodeDeleteStruct { |
| - static const char kTag = 'D'; |
| - |
| - Address address; |
| - }; |
| - |
| - |
| struct SnapshotPositionStruct { |
| static const char kTag = 'P'; |
| @@ -422,15 +400,11 @@ void LowLevelLogger::LogCodeInfo() { |
| LogWriteBytes(arch, sizeof(arch)); |
| } |
| - |
| -void LowLevelLogger::LogRecordedBuffer(Code* code, |
| - SharedFunctionInfo*, |
| - const char* name, |
| - int length) { |
| +void LowLevelLogger::LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo*, |
| + const char* name, int length) { |
| CodeCreateStruct event; |
| event.name_size = length; |
| event.code_address = code->instruction_start(); |
| - DCHECK(event.code_address == code->address() + Code::kHeaderSize); |
| event.code_size = code->instruction_size(); |
| LogWriteStruct(event); |
| LogWriteBytes(name, length); |
| @@ -439,27 +413,23 @@ void LowLevelLogger::LogRecordedBuffer(Code* code, |
| code->instruction_size()); |
| } |
| - |
| -void LowLevelLogger::CodeMoveEvent(Address from, Address to) { |
| +void LowLevelLogger::CodeMoveEvent(AbstractCode* from, Address to) { |
| CodeMoveStruct event; |
| - event.from_address = from + Code::kHeaderSize; |
| - event.to_address = to + Code::kHeaderSize; |
| + event.from_address = from->instruction_start(); |
| + size_t header_size = from->instruction_start() - from->address(); |
| + event.to_address = to + header_size; |
| LogWriteStruct(event); |
| } |
| - |
| -void LowLevelLogger::CodeDeleteEvent(Address from) { |
| - CodeDeleteStruct event; |
| - event.address = from + Code::kHeaderSize; |
| - LogWriteStruct(event); |
| -} |
| - |
| - |
| void LowLevelLogger::SnapshotPositionEvent(Address addr, int pos) { |
| - SnapshotPositionStruct event; |
| - event.address = addr + Code::kHeaderSize; |
| - event.position = pos; |
| - LogWriteStruct(event); |
| + HeapObject* obj = HeapObject::FromAddress(addr); |
| + if (obj->IsAbstractCode()) { |
| + SnapshotPositionStruct event; |
| + event.address = |
| + addr + (obj->IsCode() ? Code::kHeaderSize : BytecodeArray::kHeaderSize); |
| + event.position = pos; |
| + LogWriteStruct(event); |
| + } |
| } |
| @@ -484,23 +454,19 @@ class JitLogger : public CodeEventLogger { |
| public: |
| explicit JitLogger(JitCodeEventHandler code_event_handler); |
| - virtual void CodeMoveEvent(Address from, Address to); |
| - virtual void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) { } |
| - virtual void CodeDeleteEvent(Address from); |
| - virtual void AddCodeLinePosInfoEvent( |
| - void* jit_handler_data, |
| - int pc_offset, |
| - int position, |
| - JitCodeEvent::PositionType position_type); |
| + void CodeMoveEvent(AbstractCode* from, Address to) override; |
| + void CodeDisableOptEvent(AbstractCode* code, |
| + SharedFunctionInfo* shared) override {} |
| + void AddCodeLinePosInfoEvent(void* jit_handler_data, int pc_offset, |
| + int position, |
| + JitCodeEvent::PositionType position_type); |
| void* StartCodePosInfoEvent(); |
| - void EndCodePosInfoEvent(Code* code, void* jit_handler_data); |
| + void EndCodePosInfoEvent(AbstractCode* code, void* jit_handler_data); |
| private: |
| - virtual void LogRecordedBuffer(Code* code, |
| - SharedFunctionInfo* shared, |
| - const char* name, |
| - int length); |
| + void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared, |
| + const char* name, int length) override; |
| JitCodeEventHandler code_event_handler_; |
| base::Mutex logger_mutex_; |
| @@ -511,10 +477,8 @@ JitLogger::JitLogger(JitCodeEventHandler code_event_handler) |
| : code_event_handler_(code_event_handler) { |
| } |
| - |
| -void JitLogger::LogRecordedBuffer(Code* code, |
| - SharedFunctionInfo* shared, |
| - const char* name, |
| +void JitLogger::LogRecordedBuffer(AbstractCode* code, |
| + SharedFunctionInfo* shared, const char* name, |
| int length) { |
| JitCodeEvent event; |
| memset(&event, 0, sizeof(event)); |
| @@ -531,35 +495,19 @@ void JitLogger::LogRecordedBuffer(Code* code, |
| code_event_handler_(&event); |
| } |
| - |
| -void JitLogger::CodeMoveEvent(Address from, Address to) { |
| +void JitLogger::CodeMoveEvent(AbstractCode* from, Address to) { |
| base::LockGuard<base::Mutex> guard(&logger_mutex_); |
| - Code* from_code = Code::cast(HeapObject::FromAddress(from)); |
| JitCodeEvent event; |
| event.type = JitCodeEvent::CODE_MOVED; |
| - event.code_start = from_code->instruction_start(); |
| - event.code_len = from_code->instruction_size(); |
| + event.code_start = from->instruction_start(); |
| + event.code_len = from->instruction_size(); |
| // Calculate the header size. |
| - const size_t header_size = |
| - from_code->instruction_start() - reinterpret_cast<byte*>(from_code); |
| + const size_t header_size = from->instruction_start() - from->address(); |
| // Calculate the new start address of the instructions. |
| - event.new_code_start = |
| - reinterpret_cast<byte*>(HeapObject::FromAddress(to)) + header_size; |
| - |
| - code_event_handler_(&event); |
| -} |
| - |
| - |
| -void JitLogger::CodeDeleteEvent(Address from) { |
| - Code* from_code = Code::cast(HeapObject::FromAddress(from)); |
| - |
| - JitCodeEvent event; |
| - event.type = JitCodeEvent::CODE_REMOVED; |
|
rmcilroy
2016/02/25 15:06:54
I will remove the JitCodeEvent::CODE_REMOVED enum
|
| - event.code_start = from_code->instruction_start(); |
| - event.code_len = from_code->instruction_size(); |
| + event.new_code_start = to + header_size; |
| code_event_handler_(&event); |
| } |
| @@ -590,8 +538,8 @@ void* JitLogger::StartCodePosInfoEvent() { |
| return event.user_data; |
| } |
| - |
| -void JitLogger::EndCodePosInfoEvent(Code* code, void* jit_handler_data) { |
| +void JitLogger::EndCodePosInfoEvent(AbstractCode* code, |
| + void* jit_handler_data) { |
| JitCodeEvent event; |
| memset(&event, 0, sizeof(event)); |
| event.type = JitCodeEvent::CODE_END_LINE_INFO_RECORDING; |
| @@ -1136,10 +1084,9 @@ void Logger::SetterCallbackEvent(Name* name, Address entry_point) { |
| CallbackEventInternal("set ", name, entry_point); |
| } |
| - |
| static void AppendCodeCreateHeader(Log::MessageBuilder* msg, |
| Logger::LogEventsAndTags tag, |
| - Code* code) { |
| + AbstractCode* code) { |
| DCHECK(msg); |
| msg->Append("%s,%s,%d,", |
| kLogEventsNames[Logger::CODE_CREATION_EVENT], |
| @@ -1149,9 +1096,7 @@ static void AppendCodeCreateHeader(Log::MessageBuilder* msg, |
| msg->Append(",%d,", code->ExecutableSize()); |
| } |
| - |
| -void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| - Code* code, |
| +void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
| const char* comment) { |
| PROFILER_LOG(CodeCreateEvent(tag, code, comment)); |
| @@ -1165,9 +1110,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| msg.WriteToLogFile(); |
| } |
| - |
| -void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| - Code* code, |
| +void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
| Name* name) { |
| PROFILER_LOG(CodeCreateEvent(tag, code, name)); |
| @@ -1187,11 +1130,8 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| msg.WriteToLogFile(); |
| } |
| - |
| -void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| - Code* code, |
| - SharedFunctionInfo* shared, |
| - CompilationInfo* info, |
| +void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
| + SharedFunctionInfo* shared, CompilationInfo* info, |
| Name* name) { |
| PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, name)); |
| @@ -1199,7 +1139,10 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| CALL_LISTENERS(CodeCreateEvent(tag, code, shared, info, name)); |
| if (!FLAG_log_code || !log_->IsEnabled()) return; |
| - if (code == isolate_->builtins()->builtin(Builtins::kCompileLazy)) return; |
| + if (code == AbstractCode::cast( |
| + isolate_->builtins()->builtin(Builtins::kCompileLazy))) { |
| + return; |
| + } |
| Log::MessageBuilder msg(log_); |
| AppendCodeCreateHeader(&msg, tag, code); |
| @@ -1220,10 +1163,8 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| // Although, it is possible to extract source and line from |
| // the SharedFunctionInfo object, we left it to caller |
| // to leave logging functions free from heap allocations. |
| -void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| - Code* code, |
| - SharedFunctionInfo* shared, |
| - CompilationInfo* info, |
| +void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
| + SharedFunctionInfo* shared, CompilationInfo* info, |
| Name* source, int line, int column) { |
| PROFILER_LOG(CodeCreateEvent(tag, code, shared, info, source, line, column)); |
| @@ -1250,9 +1191,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| msg.WriteToLogFile(); |
| } |
| - |
| -void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| - Code* code, |
| +void Logger::CodeCreateEvent(LogEventsAndTags tag, AbstractCode* code, |
| int args_count) { |
| PROFILER_LOG(CodeCreateEvent(tag, code, args_count)); |
| @@ -1266,8 +1205,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, |
| msg.WriteToLogFile(); |
| } |
| - |
| -void Logger::CodeDisableOptEvent(Code* code, |
| +void Logger::CodeDisableOptEvent(AbstractCode* code, |
| SharedFunctionInfo* shared) { |
| PROFILER_LOG(CodeDisableOptEvent(code, shared)); |
| @@ -1294,8 +1232,7 @@ void Logger::CodeMovingGCEvent() { |
| base::OS::SignalCodeMovingGC(); |
| } |
| - |
| -void Logger::RegExpCodeCreateEvent(Code* code, String* source) { |
| +void Logger::RegExpCodeCreateEvent(AbstractCode* code, String* source) { |
| PROFILER_LOG(RegExpCodeCreateEvent(code, source)); |
| if (!is_logging_code_events()) return; |
| @@ -1310,33 +1247,16 @@ void Logger::RegExpCodeCreateEvent(Code* code, String* source) { |
| msg.WriteToLogFile(); |
| } |
| - |
| -void Logger::CodeMoveEvent(Address from, Address to) { |
| +void Logger::CodeMoveEvent(AbstractCode* from, Address to) { |
| PROFILER_LOG(CodeMoveEvent(from, to)); |
| if (!is_logging_code_events()) return; |
| CALL_LISTENERS(CodeMoveEvent(from, to)); |
| - MoveEventInternal(CODE_MOVE_EVENT, from, to); |
| -} |
| - |
| - |
| -void Logger::CodeDeleteEvent(Address from) { |
| - PROFILER_LOG(CodeDeleteEvent(from)); |
| - |
| - if (!is_logging_code_events()) return; |
| - CALL_LISTENERS(CodeDeleteEvent(from)); |
| - |
| - if (!FLAG_log_code || !log_->IsEnabled()) return; |
| - Log::MessageBuilder msg(log_); |
| - msg.Append("%s,", kLogEventsNames[CODE_DELETE_EVENT]); |
| - msg.AppendAddress(from); |
| - msg.WriteToLogFile(); |
| + MoveEventInternal(CODE_MOVE_EVENT, from->address(), to); |
| } |
| - |
| void Logger::CodeLinePosInfoAddPositionEvent(void* jit_handler_data, |
| - int pc_offset, |
| - int position) { |
| + int pc_offset, int position) { |
| JIT_LOG(AddCodeLinePosInfoEvent(jit_handler_data, |
| pc_offset, |
| position, |
| @@ -1360,8 +1280,7 @@ void Logger::CodeStartLinePosInfoRecordEvent(PositionsRecorder* pos_recorder) { |
| } |
| } |
| - |
| -void Logger::CodeEndLinePosInfoRecordEvent(Code* code, |
| +void Logger::CodeEndLinePosInfoRecordEvent(AbstractCode* code, |
| void* jit_handler_data) { |
| JIT_LOG(EndCodePosInfoEvent(code, jit_handler_data)); |
| } |
| @@ -1539,9 +1458,9 @@ void Logger::LogFailure() { |
| class EnumerateOptimizedFunctionsVisitor: public OptimizedFunctionVisitor { |
| public: |
| EnumerateOptimizedFunctionsVisitor(Handle<SharedFunctionInfo>* sfis, |
| - Handle<Code>* code_objects, |
| + Handle<AbstractCode>* code_objects, |
| int* count) |
| - : sfis_(sfis), code_objects_(code_objects), count_(count) { } |
| + : sfis_(sfis), code_objects_(code_objects), count_(count) {} |
| virtual void EnterContext(Context* context) {} |
| virtual void LeaveContext(Context* context) {} |
| @@ -1555,22 +1474,22 @@ class EnumerateOptimizedFunctionsVisitor: public OptimizedFunctionVisitor { |
| sfis_[*count_] = Handle<SharedFunctionInfo>(sfi); |
| } |
| if (code_objects_ != NULL) { |
| - DCHECK(function->code()->kind() == Code::OPTIMIZED_FUNCTION); |
| - code_objects_[*count_] = Handle<Code>(function->code()); |
| + DCHECK(function->abstract_code()->kind() == |
| + AbstractCode::OPTIMIZED_FUNCTION); |
| + code_objects_[*count_] = Handle<AbstractCode>(function->abstract_code()); |
| } |
| *count_ = *count_ + 1; |
| } |
| private: |
| Handle<SharedFunctionInfo>* sfis_; |
| - Handle<Code>* code_objects_; |
| + Handle<AbstractCode>* code_objects_; |
| int* count_; |
| }; |
| - |
| static int EnumerateCompiledFunctions(Heap* heap, |
| Handle<SharedFunctionInfo>* sfis, |
| - Handle<Code>* code_objects) { |
| + Handle<AbstractCode>* code_objects) { |
| HeapIterator iterator(heap); |
| DisallowHeapAllocation no_gc; |
| int compiled_funcs_count = 0; |
| @@ -1587,7 +1506,8 @@ static int EnumerateCompiledFunctions(Heap* heap, |
| sfis[compiled_funcs_count] = Handle<SharedFunctionInfo>(sfi); |
| } |
| if (code_objects != NULL) { |
| - code_objects[compiled_funcs_count] = Handle<Code>(sfi->code()); |
| + code_objects[compiled_funcs_count] = |
| + Handle<AbstractCode>(sfi->abstract_code()); |
| } |
| ++compiled_funcs_count; |
| } |
| @@ -1604,60 +1524,61 @@ static int EnumerateCompiledFunctions(Heap* heap, |
| void Logger::LogCodeObject(Object* object) { |
| - Code* code_object = Code::cast(object); |
| + AbstractCode* code_object = AbstractCode::cast(object); |
| LogEventsAndTags tag = Logger::STUB_TAG; |
| const char* description = "Unknown code from the snapshot"; |
| switch (code_object->kind()) { |
| - case Code::FUNCTION: |
| - case Code::OPTIMIZED_FUNCTION: |
| + case AbstractCode::FUNCTION: |
| + case AbstractCode::INTERPRETED_FUNCTION: |
| + case AbstractCode::OPTIMIZED_FUNCTION: |
| return; // We log this later using LogCompiledFunctions. |
| - case Code::BINARY_OP_IC: |
| - case Code::COMPARE_IC: // fall through |
| - case Code::TO_BOOLEAN_IC: // fall through |
| - case Code::STUB: |
| - description = CodeStub::MajorName(CodeStub::GetMajorKey(code_object)); |
| + case AbstractCode::BINARY_OP_IC: |
| + case AbstractCode::COMPARE_IC: // fall through |
| + case AbstractCode::TO_BOOLEAN_IC: // fall through |
| + case AbstractCode::STUB: |
| + description = |
| + CodeStub::MajorName(CodeStub::GetMajorKey(code_object->GetCode())); |
| if (description == NULL) |
| description = "A stub from the snapshot"; |
| tag = Logger::STUB_TAG; |
| break; |
| - case Code::REGEXP: |
| + case AbstractCode::REGEXP: |
| description = "Regular expression code"; |
| tag = Logger::REG_EXP_TAG; |
| break; |
| - case Code::BUILTIN: |
| - description = isolate_->builtins()->name(code_object->builtin_index()); |
| + case AbstractCode::BUILTIN: |
| + description = |
| + isolate_->builtins()->name(code_object->GetCode()->builtin_index()); |
| tag = Logger::BUILTIN_TAG; |
| break; |
| - case Code::HANDLER: |
| + case AbstractCode::HANDLER: |
| description = "An IC handler from the snapshot"; |
| tag = Logger::HANDLER_TAG; |
| break; |
| - case Code::KEYED_LOAD_IC: |
| + case AbstractCode::KEYED_LOAD_IC: |
| description = "A keyed load IC from the snapshot"; |
| tag = Logger::KEYED_LOAD_IC_TAG; |
| break; |
| - case Code::LOAD_IC: |
| + case AbstractCode::LOAD_IC: |
| description = "A load IC from the snapshot"; |
| tag = Logger::LOAD_IC_TAG; |
| break; |
| - case Code::CALL_IC: |
| + case AbstractCode::CALL_IC: |
| description = "A call IC from the snapshot"; |
| tag = Logger::CALL_IC_TAG; |
| break; |
| - case Code::STORE_IC: |
| + case AbstractCode::STORE_IC: |
| description = "A store IC from the snapshot"; |
| tag = Logger::STORE_IC_TAG; |
| break; |
| - case Code::KEYED_STORE_IC: |
| + case AbstractCode::KEYED_STORE_IC: |
| description = "A keyed store IC from the snapshot"; |
| tag = Logger::KEYED_STORE_IC_TAG; |
| break; |
| - case Code::WASM_FUNCTION: |
| + case AbstractCode::WASM_FUNCTION: |
| description = "A wasm function"; |
| tag = Logger::STUB_TAG; |
| break; |
| - case Code::NUMBER_OF_KINDS: |
| - break; |
| } |
| PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); |
| } |
| @@ -1671,12 +1592,12 @@ void Logger::LogCodeObjects() { |
| DisallowHeapAllocation no_gc; |
| for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| if (obj->IsCode()) LogCodeObject(obj); |
| + if (obj->IsBytecodeArray()) LogCodeObject(obj); |
| } |
| } |
| - |
| void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, |
| - Handle<Code> code) { |
| + Handle<AbstractCode> code) { |
| Handle<String> func_name(shared->DebugName()); |
| if (shared->script()->IsScript()) { |
| Handle<Script> script(Script::cast(shared->script())); |
| @@ -1730,7 +1651,7 @@ void Logger::LogCompiledFunctions() { |
| HandleScope scope(isolate_); |
| const int compiled_funcs_count = EnumerateCompiledFunctions(heap, NULL, NULL); |
| ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); |
| - ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); |
| + ScopedVector<Handle<AbstractCode> > code_objects(compiled_funcs_count); |
| EnumerateCompiledFunctions(heap, sfis.start(), code_objects.start()); |
| // During iteration, there can be heap allocation due to |