code) { Handle cell = Code::WeakCellFor(code); Heap* heap = isolate->heap(); if (heap->InNewSpace(*object)) { heap->AddWeakNewSpaceObjectToCodeDependency(object, cell); } else { Handle dep(heap->LookupWeakObjectToCodeDependency(object)); dep = DependentCode::InsertWeakCode(dep, DependentCode::kWeakCodeGroup, cell); heap->AddWeakObjectToCodeDependency(object, dep); } } } // namespace void CompilationJob::RegisterWeakObjectsInOptimizedCode(Handle code) { // TODO(turbofan): Move this to pipeline.cc once Crankshaft dies. Isolate* const isolate = code->GetIsolate(); DCHECK(code->is_optimized_code()); std::vector> maps; std::vector> objects; { DisallowHeapAllocation no_gc; int const mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | RelocInfo::ModeMask(RelocInfo::CELL); for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { RelocInfo::Mode mode = it.rinfo()->rmode(); if (mode == RelocInfo::CELL && code->IsWeakObjectInOptimizedCode(it.rinfo()->target_cell())) { objects.push_back(handle(it.rinfo()->target_cell(), isolate)); } else if (mode == RelocInfo::EMBEDDED_OBJECT && code->IsWeakObjectInOptimizedCode( it.rinfo()->target_object())) { Handle object(HeapObject::cast(it.rinfo()->target_object()), isolate); if (object->IsMap()) { maps.push_back(Handle::cast(object)); } else { objects.push_back(object); } } } } for (Handle map : maps) { if (map->dependent_code()->IsEmpty(DependentCode::kWeakCodeGroup)) { isolate->heap()->AddRetainedMap(map); } Map::AddDependentCode(map, DependentCode::kWeakCodeGroup, code); } for (Handle object : objects) { AddWeakObjectToCodeDependency(isolate, object, code); } code->set_can_have_weak_objects(true); } // ---------------------------------------------------------------------------- // Local helper methods that make up the compilation pipeline. namespace { void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, CompilationInfo* info) { // Log the code generation. If source information is available include // script name and line number. Check explicitly whether logging is // enabled as finding the line number is not free. if (info->isolate()->logger()->is_logging_code_events() || info->isolate()->is_profiling()) { Handle shared = info->shared_info(); Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
code) { // TODO(turbofan): Move this to pipeline.cc once Crankshaft dies. Isolate* const isolate = code->GetIsolate(); DCHECK(code->is_optimized_code()); std::vector> maps; std::vector> objects; { DisallowHeapAllocation no_gc; int const mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | RelocInfo::ModeMask(RelocInfo::CELL); for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { RelocInfo::Mode mode = it.rinfo()->rmode(); if (mode == RelocInfo::CELL && code->IsWeakObjectInOptimizedCode(it.rinfo()->target_cell())) { objects.push_back(handle(it.rinfo()->target_cell(), isolate)); } else if (mode == RelocInfo::EMBEDDED_OBJECT && code->IsWeakObjectInOptimizedCode( it.rinfo()->target_object())) { Handle object(HeapObject::cast(it.rinfo()->target_object()), isolate); if (object->IsMap()) { maps.push_back(Handle::cast(object)); } else { objects.push_back(object); } } } } for (Handle map : maps) { if (map->dependent_code()->IsEmpty(DependentCode::kWeakCodeGroup)) { isolate->heap()->AddRetainedMap(map); } Map::AddDependentCode(map, DependentCode::kWeakCodeGroup, code); } for (Handle object : objects) { AddWeakObjectToCodeDependency(isolate, object, code); } code->set_can_have_weak_objects(true); } // ---------------------------------------------------------------------------- // Local helper methods that make up the compilation pipeline. namespace { void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, CompilationInfo* info) { // Log the code generation. If source information is available include // script name and line number. Check explicitly whether logging is // enabled as finding the line number is not free. if (info->isolate()->logger()->is_logging_code_events() || info->isolate()->is_profiling()) { Handle shared = info->shared_info(); Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
您还没有登录,登录后您可以:
首次使用?从这里 注册