* 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) { DCHECK(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(Heap* heap, Handle* sfis, Handle* code_objects) { HeapIterator iterator(heap); DisallowHeapAllocation no_gc; 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(heap->isolate(), &visitor); return compiled_funcs_count; } void Logger::LogCodeObject(Object* object) { 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::BINARY_OP_IC: case Code::COMPARE_IC: // fall through case Code::COMPARE_NIL_IC: // fall through case Code::TO_BOOLEAN_IC: // fall through case Code::STUB: description = CodeStub::MajorName(CodeStub::GetMajorKey(code_object)); if (description == NULL) description = "A stub from the snapshot"; tag = Logger::STUB_TAG; break; case Code::REGEXP: description = "Regular expression code"; tag = Logger::REG_EXP_TAG; break; case Code::BUILTIN: description = isolate_->builtins()->name(code_object->builtin_index()); tag = Logger::BUILTIN_TAG; break; case Code::HANDLER: description = "An IC handler from the snapshot"; tag = Logger::HANDLER_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::CALL_IC: description = "A call IC from the snapshot"; tag = Logger::CALL_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::WASM_FUNCTION: description = "A wasm function"; tag = Logger::STUB_TAG; break; case Code::NUMBER_OF_KINDS: break; } PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); } void Logger::LogCodeObjects() { Heap* heap = isolate_->heap(); heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, "Logger::LogCodeObjects"); HeapIterator iterator(heap); DisallowHeapAllocation no_gc; 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(Heap* heap, Handle* sfis, Handle* code_objects) { HeapIterator iterator(heap); DisallowHeapAllocation no_gc; 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(heap->isolate(), &visitor); return compiled_funcs_count; } void Logger::LogCodeObject(Object* object) { 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::BINARY_OP_IC: case Code::COMPARE_IC: // fall through case Code::COMPARE_NIL_IC: // fall through case Code::TO_BOOLEAN_IC: // fall through case Code::STUB: description = CodeStub::MajorName(CodeStub::GetMajorKey(code_object)); if (description == NULL) description = "A stub from the snapshot"; tag = Logger::STUB_TAG; break; case Code::REGEXP: description = "Regular expression code"; tag = Logger::REG_EXP_TAG; break; case Code::BUILTIN: description = isolate_->builtins()->name(code_object->builtin_index()); tag = Logger::BUILTIN_TAG; break; case Code::HANDLER: description = "An IC handler from the snapshot"; tag = Logger::HANDLER_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::CALL_IC: description = "A call IC from the snapshot"; tag = Logger::CALL_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::WASM_FUNCTION: description = "A wasm function"; tag = Logger::STUB_TAG; break; case Code::NUMBER_OF_KINDS: break; } PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); } void Logger::LogCodeObjects() { Heap* heap = isolate_->heap(); heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, "Logger::LogCodeObjects"); HeapIterator iterator(heap); DisallowHeapAllocation no_gc; 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(Heap* heap, Handle* sfis, Handle* code_objects) { HeapIterator iterator(heap); DisallowHeapAllocation no_gc; 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(heap->isolate(), &visitor); return compiled_funcs_count; } void Logger::LogCodeObject(Object* object) { 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::BINARY_OP_IC: case Code::COMPARE_IC: // fall through case Code::COMPARE_NIL_IC: // fall through case Code::TO_BOOLEAN_IC: // fall through case Code::STUB: description = CodeStub::MajorName(CodeStub::GetMajorKey(code_object)); if (description == NULL) description = "A stub from the snapshot"; tag = Logger::STUB_TAG; break; case Code::REGEXP: description = "Regular expression code"; tag = Logger::REG_EXP_TAG; break; case Code::BUILTIN: description = isolate_->builtins()->name(code_object->builtin_index()); tag = Logger::BUILTIN_TAG; break; case Code::HANDLER: description = "An IC handler from the snapshot"; tag = Logger::HANDLER_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::CALL_IC: description = "A call IC from the snapshot"; tag = Logger::CALL_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::WASM_FUNCTION: description = "A wasm function"; tag = Logger::STUB_TAG; break; case Code::NUMBER_OF_KINDS: break; } PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); } void Logger::LogCodeObjects() { Heap* heap = isolate_->heap(); heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, "Logger::LogCodeObjects"); HeapIterator iterator(heap); DisallowHeapAllocation no_gc; 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(heap); DisallowHeapAllocation no_gc; 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(heap->isolate(), &visitor); return compiled_funcs_count; } void Logger::LogCodeObject(Object* object) { 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::BINARY_OP_IC: case Code::COMPARE_IC: // fall through case Code::COMPARE_NIL_IC: // fall through case Code::TO_BOOLEAN_IC: // fall through case Code::STUB: description = CodeStub::MajorName(CodeStub::GetMajorKey(code_object)); if (description == NULL) description = "A stub from the snapshot"; tag = Logger::STUB_TAG; break; case Code::REGEXP: description = "Regular expression code"; tag = Logger::REG_EXP_TAG; break; case Code::BUILTIN: description = isolate_->builtins()->name(code_object->builtin_index()); tag = Logger::BUILTIN_TAG; break; case Code::HANDLER: description = "An IC handler from the snapshot"; tag = Logger::HANDLER_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::CALL_IC: description = "A call IC from the snapshot"; tag = Logger::CALL_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::WASM_FUNCTION: description = "A wasm function"; tag = Logger::STUB_TAG; break; case Code::NUMBER_OF_KINDS: break; } PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); } void Logger::LogCodeObjects() { Heap* heap = isolate_->heap(); heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, "Logger::LogCodeObjects"); HeapIterator iterator(heap); DisallowHeapAllocation no_gc; 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(heap->isolate(), &visitor); return compiled_funcs_count; } void Logger::LogCodeObject(Object* object) { 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::BINARY_OP_IC: case Code::COMPARE_IC: // fall through case Code::COMPARE_NIL_IC: // fall through case Code::TO_BOOLEAN_IC: // fall through case Code::STUB: description = CodeStub::MajorName(CodeStub::GetMajorKey(code_object)); if (description == NULL) description = "A stub from the snapshot"; tag = Logger::STUB_TAG; break; case Code::REGEXP: description = "Regular expression code"; tag = Logger::REG_EXP_TAG; break; case Code::BUILTIN: description = isolate_->builtins()->name(code_object->builtin_index()); tag = Logger::BUILTIN_TAG; break; case Code::HANDLER: description = "An IC handler from the snapshot"; tag = Logger::HANDLER_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::CALL_IC: description = "A call IC from the snapshot"; tag = Logger::CALL_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::WASM_FUNCTION: description = "A wasm function"; tag = Logger::STUB_TAG; break; case Code::NUMBER_OF_KINDS: break; } PROFILE(isolate_, CodeCreateEvent(tag, code_object, description)); } void Logger::LogCodeObjects() { Heap* heap = isolate_->heap(); heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, "Logger::LogCodeObjects"); HeapIterator iterator(heap); DisallowHeapAllocation no_gc; 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系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
您还没有登录,登录后您可以:
首次使用?从这里 注册