* code_objects, int* count) : sfis_(sfis), code_objects_(code_objects), count_(count) { } virtual void EnterContext(Context* context) {} virtual void LeaveContext(Context* context) {} virtual void VisitFunction(JSFunction* function) { SharedFunctionInfo* sfi = SharedFunctionInfo::cast(function->shared()); Object* maybe_script = sfi->script(); if (maybe_script->IsScript() && !Script::cast(maybe_script)->HasValidSource()) return; if (sfis_ != NULL) { sfis_[*count_] = Handle(sfi); } if (code_objects_ != NULL) { ASSERT(function->code()->kind() == Code::OPTIMIZED_FUNCTION); code_objects_[*count_] = Handle(function->code()); } *count_ = *count_ + 1; } private: Handle* sfis_; Handle* code_objects_; int* count_; }; static int EnumerateCompiledFunctions(Handle* sfis, Handle* code_objects) { HeapIterator iterator; AssertNoAllocation no_alloc; int compiled_funcs_count = 0; // Iterate the heap to find shared function info objects and record // the unoptimized code for them. for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { if (!obj->IsSharedFunctionInfo()) continue; SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj); if (sfi->is_compiled() && (!sfi->script()->IsScript() || Script::cast(sfi->script())->HasValidSource())) { if (sfis != NULL) { sfis[compiled_funcs_count] = Handle(sfi); } if (code_objects != NULL) { code_objects[compiled_funcs_count] = Handle(sfi->code()); } ++compiled_funcs_count; } } // Iterate all optimized functions in all contexts. EnumerateOptimizedFunctionsVisitor visitor(sfis, code_objects, &compiled_funcs_count); Deoptimizer::VisitAllOptimizedFunctions(&visitor); return compiled_funcs_count; } void Logger::LogCodeObject(Object* object) { if (FLAG_log_code || FLAG_ll_prof) { Code* code_object = Code::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: return; // We log this later using LogCompiledFunctions. case Code::UNARY_OP_IC: // fall through case Code::BINARY_OP_IC: // fall through case Code::COMPARE_IC: // fall through case Code::TO_BOOLEAN_IC: // fall through case Code::STUB: description = CodeStub::MajorName(CodeStub::GetMajorKey(code_object), true); if (description == NULL) description = "A stub from the snapshot"; tag = Logger::STUB_TAG; break; case Code::BUILTIN: description = "A builtin from the snapshot"; tag = Logger::BUILTIN_TAG; break; case Code::KEYED_LOAD_IC: description = "A keyed load IC from the snapshot"; tag = Logger::KEYED_LOAD_IC_TAG; break; case Code::LOAD_IC: description = "A load IC from the snapshot"; tag = Logger::LOAD_IC_TAG; break; case Code::STORE_IC: description = "A store IC from the snapshot"; tag = Logger::STORE_IC_TAG; break; case Code::KEYED_STORE_IC: description = "A keyed store IC from the snapshot"; tag = Logger::KEYED_STORE_IC_TAG; break; case Code::CALL_IC: description = "A call IC from the snapshot"; tag = Logger::CALL_IC_TAG; break; case Code::KEYED_CALL_IC: description = "A keyed call IC from the snapshot"; tag = Logger::KEYED_CALL_IC_TAG; break; } PROFILE(ISOLATE, CodeCreateEvent(tag, code_object, description)); } } void Logger::LogCodeInfo() { if (!log_->IsEnabled() || !FLAG_ll_prof) return; #if V8_TARGET_ARCH_IA32 const char arch[] = "ia32"; #elif V8_TARGET_ARCH_X64 const char arch[] = "x64"; #elif V8_TARGET_ARCH_ARM const char arch[] = "arm"; #elif V8_TARGET_ARCH_MIPS const char arch[] = "mips"; #else const char arch[] = "unknown"; #endif LowLevelLogWriteBytes(arch, sizeof(arch)); } void Logger::RegisterSnapshotCodeName(Code* code, const char* name, int name_size) { ASSERT(Serializer::enabled()); if (address_to_name_map_ == NULL) { address_to_name_map_ = new NameMap; } address_to_name_map_->Insert(code->address(), name, name_size); } void Logger::LowLevelCodeCreateEvent(Code* code, const char* name, int name_size) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeCreateStruct event; event.name_size = name_size; event.code_address = code->instruction_start(); ASSERT(event.code_address == code->address() + Code::kHeaderSize); event.code_size = code->instruction_size(); LowLevelLogWriteStruct(event); LowLevelLogWriteBytes(name, name_size); LowLevelLogWriteBytes( reinterpret_cast(code->instruction_start()), code->instruction_size()); } void Logger::LowLevelCodeMoveEvent(Address from, Address to) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeMoveStruct event; event.from_address = from + Code::kHeaderSize; event.to_address = to + Code::kHeaderSize; LowLevelLogWriteStruct(event); } void Logger::LowLevelCodeDeleteEvent(Address from) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeDeleteStruct event; event.address = from + Code::kHeaderSize; LowLevelLogWriteStruct(event); } void Logger::LowLevelSnapshotPositionEvent(Address addr, int pos) { if (log_->ll_output_handle_ == NULL) return; LowLevelSnapshotPositionStruct event; event.address = addr + Code::kHeaderSize; event.position = pos; LowLevelLogWriteStruct(event); } void Logger::LowLevelLogWriteBytes(const char* bytes, int size) { size_t rv = fwrite(bytes, 1, size, log_->ll_output_handle_); ASSERT(static_cast(size) == rv); USE(rv); } void Logger::LogCodeObjects() { HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, "Logger::LogCodeObjects"); HeapIterator iterator; AssertNoAllocation no_alloc; for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { if (obj->IsCode()) LogCodeObject(obj); } } void Logger::LogExistingFunction(Handle shared, Handle code) { Handle func_name(shared->DebugName()); if (shared->script()->IsScript()) { Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
(function->code()); } *count_ = *count_ + 1; } private: Handle* sfis_; Handle* code_objects_; int* count_; }; static int EnumerateCompiledFunctions(Handle* sfis, Handle* code_objects) { HeapIterator iterator; AssertNoAllocation no_alloc; int compiled_funcs_count = 0; // Iterate the heap to find shared function info objects and record // the unoptimized code for them. for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { if (!obj->IsSharedFunctionInfo()) continue; SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj); if (sfi->is_compiled() && (!sfi->script()->IsScript() || Script::cast(sfi->script())->HasValidSource())) { if (sfis != NULL) { sfis[compiled_funcs_count] = Handle(sfi); } if (code_objects != NULL) { code_objects[compiled_funcs_count] = Handle(sfi->code()); } ++compiled_funcs_count; } } // Iterate all optimized functions in all contexts. EnumerateOptimizedFunctionsVisitor visitor(sfis, code_objects, &compiled_funcs_count); Deoptimizer::VisitAllOptimizedFunctions(&visitor); return compiled_funcs_count; } void Logger::LogCodeObject(Object* object) { if (FLAG_log_code || FLAG_ll_prof) { Code* code_object = Code::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: return; // We log this later using LogCompiledFunctions. case Code::UNARY_OP_IC: // fall through case Code::BINARY_OP_IC: // fall through case Code::COMPARE_IC: // fall through case Code::TO_BOOLEAN_IC: // fall through case Code::STUB: description = CodeStub::MajorName(CodeStub::GetMajorKey(code_object), true); if (description == NULL) description = "A stub from the snapshot"; tag = Logger::STUB_TAG; break; case Code::BUILTIN: description = "A builtin from the snapshot"; tag = Logger::BUILTIN_TAG; break; case Code::KEYED_LOAD_IC: description = "A keyed load IC from the snapshot"; tag = Logger::KEYED_LOAD_IC_TAG; break; case Code::LOAD_IC: description = "A load IC from the snapshot"; tag = Logger::LOAD_IC_TAG; break; case Code::STORE_IC: description = "A store IC from the snapshot"; tag = Logger::STORE_IC_TAG; break; case Code::KEYED_STORE_IC: description = "A keyed store IC from the snapshot"; tag = Logger::KEYED_STORE_IC_TAG; break; case Code::CALL_IC: description = "A call IC from the snapshot"; tag = Logger::CALL_IC_TAG; break; case Code::KEYED_CALL_IC: description = "A keyed call IC from the snapshot"; tag = Logger::KEYED_CALL_IC_TAG; break; } PROFILE(ISOLATE, CodeCreateEvent(tag, code_object, description)); } } void Logger::LogCodeInfo() { if (!log_->IsEnabled() || !FLAG_ll_prof) return; #if V8_TARGET_ARCH_IA32 const char arch[] = "ia32"; #elif V8_TARGET_ARCH_X64 const char arch[] = "x64"; #elif V8_TARGET_ARCH_ARM const char arch[] = "arm"; #elif V8_TARGET_ARCH_MIPS const char arch[] = "mips"; #else const char arch[] = "unknown"; #endif LowLevelLogWriteBytes(arch, sizeof(arch)); } void Logger::RegisterSnapshotCodeName(Code* code, const char* name, int name_size) { ASSERT(Serializer::enabled()); if (address_to_name_map_ == NULL) { address_to_name_map_ = new NameMap; } address_to_name_map_->Insert(code->address(), name, name_size); } void Logger::LowLevelCodeCreateEvent(Code* code, const char* name, int name_size) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeCreateStruct event; event.name_size = name_size; event.code_address = code->instruction_start(); ASSERT(event.code_address == code->address() + Code::kHeaderSize); event.code_size = code->instruction_size(); LowLevelLogWriteStruct(event); LowLevelLogWriteBytes(name, name_size); LowLevelLogWriteBytes( reinterpret_cast(code->instruction_start()), code->instruction_size()); } void Logger::LowLevelCodeMoveEvent(Address from, Address to) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeMoveStruct event; event.from_address = from + Code::kHeaderSize; event.to_address = to + Code::kHeaderSize; LowLevelLogWriteStruct(event); } void Logger::LowLevelCodeDeleteEvent(Address from) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeDeleteStruct event; event.address = from + Code::kHeaderSize; LowLevelLogWriteStruct(event); } void Logger::LowLevelSnapshotPositionEvent(Address addr, int pos) { if (log_->ll_output_handle_ == NULL) return; LowLevelSnapshotPositionStruct event; event.address = addr + Code::kHeaderSize; event.position = pos; LowLevelLogWriteStruct(event); } void Logger::LowLevelLogWriteBytes(const char* bytes, int size) { size_t rv = fwrite(bytes, 1, size, log_->ll_output_handle_); ASSERT(static_cast(size) == rv); USE(rv); } void Logger::LogCodeObjects() { HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, "Logger::LogCodeObjects"); HeapIterator iterator; AssertNoAllocation no_alloc; for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { if (obj->IsCode()) LogCodeObject(obj); } } void Logger::LogExistingFunction(Handle shared, Handle code) { Handle func_name(shared->DebugName()); if (shared->script()->IsScript()) { Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
* code_objects_; int* count_; }; static int EnumerateCompiledFunctions(Handle* sfis, Handle* code_objects) { HeapIterator iterator; AssertNoAllocation no_alloc; int compiled_funcs_count = 0; // Iterate the heap to find shared function info objects and record // the unoptimized code for them. for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { if (!obj->IsSharedFunctionInfo()) continue; SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj); if (sfi->is_compiled() && (!sfi->script()->IsScript() || Script::cast(sfi->script())->HasValidSource())) { if (sfis != NULL) { sfis[compiled_funcs_count] = Handle(sfi); } if (code_objects != NULL) { code_objects[compiled_funcs_count] = Handle(sfi->code()); } ++compiled_funcs_count; } } // Iterate all optimized functions in all contexts. EnumerateOptimizedFunctionsVisitor visitor(sfis, code_objects, &compiled_funcs_count); Deoptimizer::VisitAllOptimizedFunctions(&visitor); return compiled_funcs_count; } void Logger::LogCodeObject(Object* object) { if (FLAG_log_code || FLAG_ll_prof) { Code* code_object = Code::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: return; // We log this later using LogCompiledFunctions. case Code::UNARY_OP_IC: // fall through case Code::BINARY_OP_IC: // fall through case Code::COMPARE_IC: // fall through case Code::TO_BOOLEAN_IC: // fall through case Code::STUB: description = CodeStub::MajorName(CodeStub::GetMajorKey(code_object), true); if (description == NULL) description = "A stub from the snapshot"; tag = Logger::STUB_TAG; break; case Code::BUILTIN: description = "A builtin from the snapshot"; tag = Logger::BUILTIN_TAG; break; case Code::KEYED_LOAD_IC: description = "A keyed load IC from the snapshot"; tag = Logger::KEYED_LOAD_IC_TAG; break; case Code::LOAD_IC: description = "A load IC from the snapshot"; tag = Logger::LOAD_IC_TAG; break; case Code::STORE_IC: description = "A store IC from the snapshot"; tag = Logger::STORE_IC_TAG; break; case Code::KEYED_STORE_IC: description = "A keyed store IC from the snapshot"; tag = Logger::KEYED_STORE_IC_TAG; break; case Code::CALL_IC: description = "A call IC from the snapshot"; tag = Logger::CALL_IC_TAG; break; case Code::KEYED_CALL_IC: description = "A keyed call IC from the snapshot"; tag = Logger::KEYED_CALL_IC_TAG; break; } PROFILE(ISOLATE, CodeCreateEvent(tag, code_object, description)); } } void Logger::LogCodeInfo() { if (!log_->IsEnabled() || !FLAG_ll_prof) return; #if V8_TARGET_ARCH_IA32 const char arch[] = "ia32"; #elif V8_TARGET_ARCH_X64 const char arch[] = "x64"; #elif V8_TARGET_ARCH_ARM const char arch[] = "arm"; #elif V8_TARGET_ARCH_MIPS const char arch[] = "mips"; #else const char arch[] = "unknown"; #endif LowLevelLogWriteBytes(arch, sizeof(arch)); } void Logger::RegisterSnapshotCodeName(Code* code, const char* name, int name_size) { ASSERT(Serializer::enabled()); if (address_to_name_map_ == NULL) { address_to_name_map_ = new NameMap; } address_to_name_map_->Insert(code->address(), name, name_size); } void Logger::LowLevelCodeCreateEvent(Code* code, const char* name, int name_size) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeCreateStruct event; event.name_size = name_size; event.code_address = code->instruction_start(); ASSERT(event.code_address == code->address() + Code::kHeaderSize); event.code_size = code->instruction_size(); LowLevelLogWriteStruct(event); LowLevelLogWriteBytes(name, name_size); LowLevelLogWriteBytes( reinterpret_cast(code->instruction_start()), code->instruction_size()); } void Logger::LowLevelCodeMoveEvent(Address from, Address to) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeMoveStruct event; event.from_address = from + Code::kHeaderSize; event.to_address = to + Code::kHeaderSize; LowLevelLogWriteStruct(event); } void Logger::LowLevelCodeDeleteEvent(Address from) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeDeleteStruct event; event.address = from + Code::kHeaderSize; LowLevelLogWriteStruct(event); } void Logger::LowLevelSnapshotPositionEvent(Address addr, int pos) { if (log_->ll_output_handle_ == NULL) return; LowLevelSnapshotPositionStruct event; event.address = addr + Code::kHeaderSize; event.position = pos; LowLevelLogWriteStruct(event); } void Logger::LowLevelLogWriteBytes(const char* bytes, int size) { size_t rv = fwrite(bytes, 1, size, log_->ll_output_handle_); ASSERT(static_cast(size) == rv); USE(rv); } void Logger::LogCodeObjects() { HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, "Logger::LogCodeObjects"); HeapIterator iterator; AssertNoAllocation no_alloc; for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { if (obj->IsCode()) LogCodeObject(obj); } } void Logger::LogExistingFunction(Handle shared, Handle code) { Handle func_name(shared->DebugName()); if (shared->script()->IsScript()) { Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
* code_objects) { HeapIterator iterator; AssertNoAllocation no_alloc; int compiled_funcs_count = 0; // Iterate the heap to find shared function info objects and record // the unoptimized code for them. for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { if (!obj->IsSharedFunctionInfo()) continue; SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj); if (sfi->is_compiled() && (!sfi->script()->IsScript() || Script::cast(sfi->script())->HasValidSource())) { if (sfis != NULL) { sfis[compiled_funcs_count] = Handle(sfi); } if (code_objects != NULL) { code_objects[compiled_funcs_count] = Handle(sfi->code()); } ++compiled_funcs_count; } } // Iterate all optimized functions in all contexts. EnumerateOptimizedFunctionsVisitor visitor(sfis, code_objects, &compiled_funcs_count); Deoptimizer::VisitAllOptimizedFunctions(&visitor); return compiled_funcs_count; } void Logger::LogCodeObject(Object* object) { if (FLAG_log_code || FLAG_ll_prof) { Code* code_object = Code::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: return; // We log this later using LogCompiledFunctions. case Code::UNARY_OP_IC: // fall through case Code::BINARY_OP_IC: // fall through case Code::COMPARE_IC: // fall through case Code::TO_BOOLEAN_IC: // fall through case Code::STUB: description = CodeStub::MajorName(CodeStub::GetMajorKey(code_object), true); if (description == NULL) description = "A stub from the snapshot"; tag = Logger::STUB_TAG; break; case Code::BUILTIN: description = "A builtin from the snapshot"; tag = Logger::BUILTIN_TAG; break; case Code::KEYED_LOAD_IC: description = "A keyed load IC from the snapshot"; tag = Logger::KEYED_LOAD_IC_TAG; break; case Code::LOAD_IC: description = "A load IC from the snapshot"; tag = Logger::LOAD_IC_TAG; break; case Code::STORE_IC: description = "A store IC from the snapshot"; tag = Logger::STORE_IC_TAG; break; case Code::KEYED_STORE_IC: description = "A keyed store IC from the snapshot"; tag = Logger::KEYED_STORE_IC_TAG; break; case Code::CALL_IC: description = "A call IC from the snapshot"; tag = Logger::CALL_IC_TAG; break; case Code::KEYED_CALL_IC: description = "A keyed call IC from the snapshot"; tag = Logger::KEYED_CALL_IC_TAG; break; } PROFILE(ISOLATE, CodeCreateEvent(tag, code_object, description)); } } void Logger::LogCodeInfo() { if (!log_->IsEnabled() || !FLAG_ll_prof) return; #if V8_TARGET_ARCH_IA32 const char arch[] = "ia32"; #elif V8_TARGET_ARCH_X64 const char arch[] = "x64"; #elif V8_TARGET_ARCH_ARM const char arch[] = "arm"; #elif V8_TARGET_ARCH_MIPS const char arch[] = "mips"; #else const char arch[] = "unknown"; #endif LowLevelLogWriteBytes(arch, sizeof(arch)); } void Logger::RegisterSnapshotCodeName(Code* code, const char* name, int name_size) { ASSERT(Serializer::enabled()); if (address_to_name_map_ == NULL) { address_to_name_map_ = new NameMap; } address_to_name_map_->Insert(code->address(), name, name_size); } void Logger::LowLevelCodeCreateEvent(Code* code, const char* name, int name_size) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeCreateStruct event; event.name_size = name_size; event.code_address = code->instruction_start(); ASSERT(event.code_address == code->address() + Code::kHeaderSize); event.code_size = code->instruction_size(); LowLevelLogWriteStruct(event); LowLevelLogWriteBytes(name, name_size); LowLevelLogWriteBytes( reinterpret_cast(code->instruction_start()), code->instruction_size()); } void Logger::LowLevelCodeMoveEvent(Address from, Address to) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeMoveStruct event; event.from_address = from + Code::kHeaderSize; event.to_address = to + Code::kHeaderSize; LowLevelLogWriteStruct(event); } void Logger::LowLevelCodeDeleteEvent(Address from) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeDeleteStruct event; event.address = from + Code::kHeaderSize; LowLevelLogWriteStruct(event); } void Logger::LowLevelSnapshotPositionEvent(Address addr, int pos) { if (log_->ll_output_handle_ == NULL) return; LowLevelSnapshotPositionStruct event; event.address = addr + Code::kHeaderSize; event.position = pos; LowLevelLogWriteStruct(event); } void Logger::LowLevelLogWriteBytes(const char* bytes, int size) { size_t rv = fwrite(bytes, 1, size, log_->ll_output_handle_); ASSERT(static_cast(size) == rv); USE(rv); } void Logger::LogCodeObjects() { HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, "Logger::LogCodeObjects"); HeapIterator iterator; AssertNoAllocation no_alloc; for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { if (obj->IsCode()) LogCodeObject(obj); } } void Logger::LogExistingFunction(Handle shared, Handle code) { Handle func_name(shared->DebugName()); if (shared->script()->IsScript()) { Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
(sfi->code()); } ++compiled_funcs_count; } } // Iterate all optimized functions in all contexts. EnumerateOptimizedFunctionsVisitor visitor(sfis, code_objects, &compiled_funcs_count); Deoptimizer::VisitAllOptimizedFunctions(&visitor); return compiled_funcs_count; } void Logger::LogCodeObject(Object* object) { if (FLAG_log_code || FLAG_ll_prof) { Code* code_object = Code::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: return; // We log this later using LogCompiledFunctions. case Code::UNARY_OP_IC: // fall through case Code::BINARY_OP_IC: // fall through case Code::COMPARE_IC: // fall through case Code::TO_BOOLEAN_IC: // fall through case Code::STUB: description = CodeStub::MajorName(CodeStub::GetMajorKey(code_object), true); if (description == NULL) description = "A stub from the snapshot"; tag = Logger::STUB_TAG; break; case Code::BUILTIN: description = "A builtin from the snapshot"; tag = Logger::BUILTIN_TAG; break; case Code::KEYED_LOAD_IC: description = "A keyed load IC from the snapshot"; tag = Logger::KEYED_LOAD_IC_TAG; break; case Code::LOAD_IC: description = "A load IC from the snapshot"; tag = Logger::LOAD_IC_TAG; break; case Code::STORE_IC: description = "A store IC from the snapshot"; tag = Logger::STORE_IC_TAG; break; case Code::KEYED_STORE_IC: description = "A keyed store IC from the snapshot"; tag = Logger::KEYED_STORE_IC_TAG; break; case Code::CALL_IC: description = "A call IC from the snapshot"; tag = Logger::CALL_IC_TAG; break; case Code::KEYED_CALL_IC: description = "A keyed call IC from the snapshot"; tag = Logger::KEYED_CALL_IC_TAG; break; } PROFILE(ISOLATE, CodeCreateEvent(tag, code_object, description)); } } void Logger::LogCodeInfo() { if (!log_->IsEnabled() || !FLAG_ll_prof) return; #if V8_TARGET_ARCH_IA32 const char arch[] = "ia32"; #elif V8_TARGET_ARCH_X64 const char arch[] = "x64"; #elif V8_TARGET_ARCH_ARM const char arch[] = "arm"; #elif V8_TARGET_ARCH_MIPS const char arch[] = "mips"; #else const char arch[] = "unknown"; #endif LowLevelLogWriteBytes(arch, sizeof(arch)); } void Logger::RegisterSnapshotCodeName(Code* code, const char* name, int name_size) { ASSERT(Serializer::enabled()); if (address_to_name_map_ == NULL) { address_to_name_map_ = new NameMap; } address_to_name_map_->Insert(code->address(), name, name_size); } void Logger::LowLevelCodeCreateEvent(Code* code, const char* name, int name_size) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeCreateStruct event; event.name_size = name_size; event.code_address = code->instruction_start(); ASSERT(event.code_address == code->address() + Code::kHeaderSize); event.code_size = code->instruction_size(); LowLevelLogWriteStruct(event); LowLevelLogWriteBytes(name, name_size); LowLevelLogWriteBytes( reinterpret_cast(code->instruction_start()), code->instruction_size()); } void Logger::LowLevelCodeMoveEvent(Address from, Address to) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeMoveStruct event; event.from_address = from + Code::kHeaderSize; event.to_address = to + Code::kHeaderSize; LowLevelLogWriteStruct(event); } void Logger::LowLevelCodeDeleteEvent(Address from) { if (log_->ll_output_handle_ == NULL) return; LowLevelCodeDeleteStruct event; event.address = from + Code::kHeaderSize; LowLevelLogWriteStruct(event); } void Logger::LowLevelSnapshotPositionEvent(Address addr, int pos) { if (log_->ll_output_handle_ == NULL) return; LowLevelSnapshotPositionStruct event; event.address = addr + Code::kHeaderSize; event.position = pos; LowLevelLogWriteStruct(event); } void Logger::LowLevelLogWriteBytes(const char* bytes, int size) { size_t rv = fwrite(bytes, 1, size, log_->ll_output_handle_); ASSERT(static_cast(size) == rv); USE(rv); } void Logger::LogCodeObjects() { HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, "Logger::LogCodeObjects"); HeapIterator iterator; AssertNoAllocation no_alloc; for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { if (obj->IsCode()) LogCodeObject(obj); } } void Logger::LogExistingFunction(Handle shared, Handle code) { Handle func_name(shared->DebugName()); if (shared->script()->IsScript()) { Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
code) { Handle func_name(shared->DebugName()); if (shared->script()->IsScript()) { Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
您还没有登录,登录后您可以:
首次使用?从这里 注册