code() { return code_; } void set_code(Handle code) { DCHECK(code_.is_null()); code_ = code; } // RawMachineAssembler generally produces graphs which cannot be verified. bool MayHaveUnverifiableGraph() const { return outer_zone_ == nullptr; } Zone* graph_zone() const { return graph_zone_; } Graph* graph() const { return graph_; } SourcePositionTable* source_positions() const { return source_positions_; } MachineOperatorBuilder* machine() const { return machine_; } CommonOperatorBuilder* common() const { return common_; } JSOperatorBuilder* javascript() const { return javascript_; } JSGraph* jsgraph() const { return jsgraph_; } Handle native_context() const { return handle(info()->native_context(), isolate()); } Handle global_object() const { return handle(info()->global_object(), isolate()); } LoopAssignmentAnalysis* loop_assignment() const { return loop_assignment_; } void set_loop_assignment(LoopAssignmentAnalysis* loop_assignment) { DCHECK(!loop_assignment_); loop_assignment_ = loop_assignment; } Schedule* schedule() const { return schedule_; } void set_schedule(Schedule* schedule) { DCHECK(!schedule_); schedule_ = schedule; } void reset_schedule() { schedule_ = nullptr; } Zone* instruction_zone() const { return instruction_zone_; } InstructionSequence* sequence() const { return sequence_; } Frame* frame() const { return frame_; } Zone* register_allocation_zone() const { return register_allocation_zone_; } RegisterAllocationData* register_allocation_data() const { return register_allocation_data_; } BasicBlockProfiler::Data* profiler_data() const { return profiler_data_; } void set_profiler_data(BasicBlockProfiler::Data* profiler_data) { profiler_data_ = profiler_data; } std::string const& source_position_output() const { return source_position_output_; } void set_source_position_output(std::string const& source_position_output) { source_position_output_ = source_position_output; } ZoneVector* protected_instructions() const { return protected_instructions_; } void DeleteGraphZone() { if (graph_zone_ == nullptr) return; graph_zone_scope_.Destroy(); graph_zone_ = nullptr; graph_ = nullptr; source_positions_ = nullptr; loop_assignment_ = nullptr; simplified_ = nullptr; machine_ = nullptr; common_ = nullptr; javascript_ = nullptr; jsgraph_ = nullptr; schedule_ = nullptr; } void DeleteInstructionZone() { if (instruction_zone_ == nullptr) return; instruction_zone_scope_.Destroy(); instruction_zone_ = nullptr; sequence_ = nullptr; frame_ = nullptr; } void DeleteRegisterAllocationZone() { if (register_allocation_zone_ == nullptr) return; register_allocation_zone_scope_.Destroy(); register_allocation_zone_ = nullptr; register_allocation_data_ = nullptr; } void InitializeInstructionSequence(const CallDescriptor* descriptor) { DCHECK(sequence_ == nullptr); InstructionBlocks* instruction_blocks = InstructionSequence::InstructionBlocksFor(instruction_zone(), schedule()); sequence_ = new (instruction_zone()) InstructionSequence( info()->isolate(), instruction_zone(), instruction_blocks); if (descriptor && descriptor->RequiresFrameAsIncoming()) { sequence_->instruction_blocks()[0]->mark_needs_frame(); } else { DCHECK_EQ(0u, descriptor->CalleeSavedFPRegisters()); DCHECK_EQ(0u, descriptor->CalleeSavedRegisters()); } } void InitializeFrameData(CallDescriptor* descriptor) { DCHECK(frame_ == nullptr); int fixed_frame_size = 0; if (descriptor != nullptr) { fixed_frame_size = descriptor->CalculateFixedFrameSize(); } frame_ = new (instruction_zone()) Frame(fixed_frame_size); } void InitializeRegisterAllocationData(const RegisterConfiguration* config, CallDescriptor* descriptor) { DCHECK(register_allocation_data_ == nullptr); register_allocation_data_ = new (register_allocation_zone()) RegisterAllocationData(config, register_allocation_zone(), frame(), sequence(), debug_name()); } void BeginPhaseKind(const char* phase_kind_name) { if (pipeline_statistics() != nullptr) { pipeline_statistics()->BeginPhaseKind(phase_kind_name); } } void EndPhaseKind() { if (pipeline_statistics() != nullptr) { pipeline_statistics()->EndPhaseKind(); } } const char* debug_name() const { return debug_name_.get(); } private: Isolate* const isolate_; CompilationInfo* const info_; std::unique_ptr debug_name_; Zone* outer_zone_ = nullptr; ZoneStats* const zone_stats_; PipelineStatistics* pipeline_statistics_ = nullptr; bool compilation_failed_ = false; bool verify_graph_ = false; bool is_asm_ = false; Handle code_ = Handle::null(); // All objects in the following group of fields are allocated in graph_zone_. // They are all set to nullptr when the graph_zone_ is destroyed. ZoneStats::Scope graph_zone_scope_; Zone* graph_zone_ = nullptr; Graph* graph_ = nullptr; SourcePositionTable* source_positions_ = nullptr; LoopAssignmentAnalysis* loop_assignment_ = nullptr; SimplifiedOperatorBuilder* simplified_ = nullptr; MachineOperatorBuilder* machine_ = nullptr; CommonOperatorBuilder* common_ = nullptr; JSOperatorBuilder* javascript_ = nullptr; JSGraph* jsgraph_ = nullptr; Schedule* schedule_ = nullptr; // All objects in the following group of fields are allocated in // instruction_zone_. They are all set to nullptr when the instruction_zone_ // is // destroyed. ZoneStats::Scope instruction_zone_scope_; Zone* instruction_zone_; InstructionSequence* sequence_ = nullptr; Frame* frame_ = nullptr; // All objects in the following group of fields are allocated in // register_allocation_zone_. They are all set to nullptr when the zone is // destroyed. ZoneStats::Scope register_allocation_zone_scope_; Zone* register_allocation_zone_; RegisterAllocationData* register_allocation_data_ = nullptr; // Basic block profiling support. BasicBlockProfiler::Data* profiler_data_ = nullptr; // Source position output for --trace-turbo. std::string source_position_output_; ZoneVector* protected_instructions_ = nullptr; DISALLOW_COPY_AND_ASSIGN(PipelineData); }; class PipelineImpl final { public: explicit PipelineImpl(PipelineData* data) : data_(data) {} // Helpers for executing pipeline phases. template void Run(); template void Run(Arg0 arg_0); template void Run(Arg0 arg_0, Arg1 arg_1); // Run the graph creation and initial optimization passes. bool CreateGraph(); // Run the concurrent optimization passes. bool OptimizeGraph(Linkage* linkage); // Perform the actual code generation and return handle to a code object. Handle GenerateCode(Linkage* linkage); bool ScheduleAndSelectInstructions(Linkage* linkage, bool trim_graph); void RunPrintAndVerify(const char* phase, bool untyped = false); Handle ScheduleAndGenerateCode(CallDescriptor* call_descriptor); void AllocateRegisters(const RegisterConfiguration* config, CallDescriptor* descriptor, bool run_verifier); CompilationInfo* info() const; Isolate* isolate() const; PipelineData* const data_; }; namespace { struct TurboCfgFile : public std::ofstream { explicit TurboCfgFile(Isolate* isolate) : std::ofstream(isolate->GetTurboCfgFileName().c_str(), std::ios_base::app) {} }; struct TurboJsonFile : public std::ofstream { TurboJsonFile(CompilationInfo* info, std::ios_base::openmode mode) : std::ofstream(GetVisualizerLogFileName(info, nullptr, "json").get(), mode) {} }; void TraceSchedule(CompilationInfo* info, Schedule* schedule) { if (FLAG_trace_turbo) { AllowHandleDereference allow_deref; TurboJsonFile json_of(info, std::ios_base::app); json_of << "{\"name\":\"Schedule\",\"type\":\"schedule\",\"data\":\""; std::stringstream schedule_stream; schedule_stream << *schedule; std::string schedule_string(schedule_stream.str()); for (const auto& c : schedule_string) { json_of << AsEscapedUC16ForJSON(c); } json_of << "\"},\n"; } if (FLAG_trace_turbo_graph || FLAG_trace_turbo_scheduler) { AllowHandleDereference allow_deref; CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); OFStream os(tracing_scope.file()); os << "-- Schedule --------------------------------------\n" << *schedule; } } class SourcePositionWrapper final : public Reducer { public: SourcePositionWrapper(Reducer* reducer, SourcePositionTable* table) : reducer_(reducer), table_(table) {} ~SourcePositionWrapper() final {} Reduction Reduce(Node* node) final { SourcePosition const pos = table_->GetSourcePosition(node); SourcePositionTable::Scope position(table_, pos); return reducer_->Reduce(node); } void Finalize() final { reducer_->Finalize(); } private: Reducer* const reducer_; SourcePositionTable* const table_; DISALLOW_COPY_AND_ASSIGN(SourcePositionWrapper); }; class JSGraphReducer final : public GraphReducer { public: JSGraphReducer(JSGraph* jsgraph, Zone* zone) : GraphReducer(zone, jsgraph->graph(), jsgraph->Dead()) {} ~JSGraphReducer() final {} }; void AddReducer(PipelineData* data, GraphReducer* graph_reducer, Reducer* reducer) { if (data->info()->is_source_positions_enabled()) { void* const buffer = data->graph_zone()->New(sizeof(SourcePositionWrapper)); SourcePositionWrapper* const wrapper = new (buffer) SourcePositionWrapper(reducer, data->source_positions()); graph_reducer->AddReducer(wrapper); } else { graph_reducer->AddReducer(reducer); } } class PipelineRunScope { public: PipelineRunScope(PipelineData* data, const char* phase_name) : phase_scope_( phase_name == nullptr ? nullptr : data->pipeline_statistics(), phase_name), zone_scope_(data->zone_stats(), ZONE_NAME) {} Zone* zone() { return zone_scope_.zone(); } private: PhaseScope phase_scope_; ZoneStats::Scope zone_scope_; }; PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info, ZoneStats* zone_stats) { PipelineStatistics* pipeline_statistics = nullptr; if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { pipeline_statistics = new PipelineStatistics(info, zone_stats); pipeline_statistics->BeginPhaseKind("initializing"); } if (FLAG_trace_turbo) { TurboJsonFile json_of(info, std::ios_base::trunc); Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
code) { DCHECK(code_.is_null()); code_ = code; } // RawMachineAssembler generally produces graphs which cannot be verified. bool MayHaveUnverifiableGraph() const { return outer_zone_ == nullptr; } Zone* graph_zone() const { return graph_zone_; } Graph* graph() const { return graph_; } SourcePositionTable* source_positions() const { return source_positions_; } MachineOperatorBuilder* machine() const { return machine_; } CommonOperatorBuilder* common() const { return common_; } JSOperatorBuilder* javascript() const { return javascript_; } JSGraph* jsgraph() const { return jsgraph_; } Handle native_context() const { return handle(info()->native_context(), isolate()); } Handle global_object() const { return handle(info()->global_object(), isolate()); } LoopAssignmentAnalysis* loop_assignment() const { return loop_assignment_; } void set_loop_assignment(LoopAssignmentAnalysis* loop_assignment) { DCHECK(!loop_assignment_); loop_assignment_ = loop_assignment; } Schedule* schedule() const { return schedule_; } void set_schedule(Schedule* schedule) { DCHECK(!schedule_); schedule_ = schedule; } void reset_schedule() { schedule_ = nullptr; } Zone* instruction_zone() const { return instruction_zone_; } InstructionSequence* sequence() const { return sequence_; } Frame* frame() const { return frame_; } Zone* register_allocation_zone() const { return register_allocation_zone_; } RegisterAllocationData* register_allocation_data() const { return register_allocation_data_; } BasicBlockProfiler::Data* profiler_data() const { return profiler_data_; } void set_profiler_data(BasicBlockProfiler::Data* profiler_data) { profiler_data_ = profiler_data; } std::string const& source_position_output() const { return source_position_output_; } void set_source_position_output(std::string const& source_position_output) { source_position_output_ = source_position_output; } ZoneVector* protected_instructions() const { return protected_instructions_; } void DeleteGraphZone() { if (graph_zone_ == nullptr) return; graph_zone_scope_.Destroy(); graph_zone_ = nullptr; graph_ = nullptr; source_positions_ = nullptr; loop_assignment_ = nullptr; simplified_ = nullptr; machine_ = nullptr; common_ = nullptr; javascript_ = nullptr; jsgraph_ = nullptr; schedule_ = nullptr; } void DeleteInstructionZone() { if (instruction_zone_ == nullptr) return; instruction_zone_scope_.Destroy(); instruction_zone_ = nullptr; sequence_ = nullptr; frame_ = nullptr; } void DeleteRegisterAllocationZone() { if (register_allocation_zone_ == nullptr) return; register_allocation_zone_scope_.Destroy(); register_allocation_zone_ = nullptr; register_allocation_data_ = nullptr; } void InitializeInstructionSequence(const CallDescriptor* descriptor) { DCHECK(sequence_ == nullptr); InstructionBlocks* instruction_blocks = InstructionSequence::InstructionBlocksFor(instruction_zone(), schedule()); sequence_ = new (instruction_zone()) InstructionSequence( info()->isolate(), instruction_zone(), instruction_blocks); if (descriptor && descriptor->RequiresFrameAsIncoming()) { sequence_->instruction_blocks()[0]->mark_needs_frame(); } else { DCHECK_EQ(0u, descriptor->CalleeSavedFPRegisters()); DCHECK_EQ(0u, descriptor->CalleeSavedRegisters()); } } void InitializeFrameData(CallDescriptor* descriptor) { DCHECK(frame_ == nullptr); int fixed_frame_size = 0; if (descriptor != nullptr) { fixed_frame_size = descriptor->CalculateFixedFrameSize(); } frame_ = new (instruction_zone()) Frame(fixed_frame_size); } void InitializeRegisterAllocationData(const RegisterConfiguration* config, CallDescriptor* descriptor) { DCHECK(register_allocation_data_ == nullptr); register_allocation_data_ = new (register_allocation_zone()) RegisterAllocationData(config, register_allocation_zone(), frame(), sequence(), debug_name()); } void BeginPhaseKind(const char* phase_kind_name) { if (pipeline_statistics() != nullptr) { pipeline_statistics()->BeginPhaseKind(phase_kind_name); } } void EndPhaseKind() { if (pipeline_statistics() != nullptr) { pipeline_statistics()->EndPhaseKind(); } } const char* debug_name() const { return debug_name_.get(); } private: Isolate* const isolate_; CompilationInfo* const info_; std::unique_ptr debug_name_; Zone* outer_zone_ = nullptr; ZoneStats* const zone_stats_; PipelineStatistics* pipeline_statistics_ = nullptr; bool compilation_failed_ = false; bool verify_graph_ = false; bool is_asm_ = false; Handle code_ = Handle::null(); // All objects in the following group of fields are allocated in graph_zone_. // They are all set to nullptr when the graph_zone_ is destroyed. ZoneStats::Scope graph_zone_scope_; Zone* graph_zone_ = nullptr; Graph* graph_ = nullptr; SourcePositionTable* source_positions_ = nullptr; LoopAssignmentAnalysis* loop_assignment_ = nullptr; SimplifiedOperatorBuilder* simplified_ = nullptr; MachineOperatorBuilder* machine_ = nullptr; CommonOperatorBuilder* common_ = nullptr; JSOperatorBuilder* javascript_ = nullptr; JSGraph* jsgraph_ = nullptr; Schedule* schedule_ = nullptr; // All objects in the following group of fields are allocated in // instruction_zone_. They are all set to nullptr when the instruction_zone_ // is // destroyed. ZoneStats::Scope instruction_zone_scope_; Zone* instruction_zone_; InstructionSequence* sequence_ = nullptr; Frame* frame_ = nullptr; // All objects in the following group of fields are allocated in // register_allocation_zone_. They are all set to nullptr when the zone is // destroyed. ZoneStats::Scope register_allocation_zone_scope_; Zone* register_allocation_zone_; RegisterAllocationData* register_allocation_data_ = nullptr; // Basic block profiling support. BasicBlockProfiler::Data* profiler_data_ = nullptr; // Source position output for --trace-turbo. std::string source_position_output_; ZoneVector* protected_instructions_ = nullptr; DISALLOW_COPY_AND_ASSIGN(PipelineData); }; class PipelineImpl final { public: explicit PipelineImpl(PipelineData* data) : data_(data) {} // Helpers for executing pipeline phases. template void Run(); template void Run(Arg0 arg_0); template void Run(Arg0 arg_0, Arg1 arg_1); // Run the graph creation and initial optimization passes. bool CreateGraph(); // Run the concurrent optimization passes. bool OptimizeGraph(Linkage* linkage); // Perform the actual code generation and return handle to a code object. Handle GenerateCode(Linkage* linkage); bool ScheduleAndSelectInstructions(Linkage* linkage, bool trim_graph); void RunPrintAndVerify(const char* phase, bool untyped = false); Handle ScheduleAndGenerateCode(CallDescriptor* call_descriptor); void AllocateRegisters(const RegisterConfiguration* config, CallDescriptor* descriptor, bool run_verifier); CompilationInfo* info() const; Isolate* isolate() const; PipelineData* const data_; }; namespace { struct TurboCfgFile : public std::ofstream { explicit TurboCfgFile(Isolate* isolate) : std::ofstream(isolate->GetTurboCfgFileName().c_str(), std::ios_base::app) {} }; struct TurboJsonFile : public std::ofstream { TurboJsonFile(CompilationInfo* info, std::ios_base::openmode mode) : std::ofstream(GetVisualizerLogFileName(info, nullptr, "json").get(), mode) {} }; void TraceSchedule(CompilationInfo* info, Schedule* schedule) { if (FLAG_trace_turbo) { AllowHandleDereference allow_deref; TurboJsonFile json_of(info, std::ios_base::app); json_of << "{\"name\":\"Schedule\",\"type\":\"schedule\",\"data\":\""; std::stringstream schedule_stream; schedule_stream << *schedule; std::string schedule_string(schedule_stream.str()); for (const auto& c : schedule_string) { json_of << AsEscapedUC16ForJSON(c); } json_of << "\"},\n"; } if (FLAG_trace_turbo_graph || FLAG_trace_turbo_scheduler) { AllowHandleDereference allow_deref; CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); OFStream os(tracing_scope.file()); os << "-- Schedule --------------------------------------\n" << *schedule; } } class SourcePositionWrapper final : public Reducer { public: SourcePositionWrapper(Reducer* reducer, SourcePositionTable* table) : reducer_(reducer), table_(table) {} ~SourcePositionWrapper() final {} Reduction Reduce(Node* node) final { SourcePosition const pos = table_->GetSourcePosition(node); SourcePositionTable::Scope position(table_, pos); return reducer_->Reduce(node); } void Finalize() final { reducer_->Finalize(); } private: Reducer* const reducer_; SourcePositionTable* const table_; DISALLOW_COPY_AND_ASSIGN(SourcePositionWrapper); }; class JSGraphReducer final : public GraphReducer { public: JSGraphReducer(JSGraph* jsgraph, Zone* zone) : GraphReducer(zone, jsgraph->graph(), jsgraph->Dead()) {} ~JSGraphReducer() final {} }; void AddReducer(PipelineData* data, GraphReducer* graph_reducer, Reducer* reducer) { if (data->info()->is_source_positions_enabled()) { void* const buffer = data->graph_zone()->New(sizeof(SourcePositionWrapper)); SourcePositionWrapper* const wrapper = new (buffer) SourcePositionWrapper(reducer, data->source_positions()); graph_reducer->AddReducer(wrapper); } else { graph_reducer->AddReducer(reducer); } } class PipelineRunScope { public: PipelineRunScope(PipelineData* data, const char* phase_name) : phase_scope_( phase_name == nullptr ? nullptr : data->pipeline_statistics(), phase_name), zone_scope_(data->zone_stats(), ZONE_NAME) {} Zone* zone() { return zone_scope_.zone(); } private: PhaseScope phase_scope_; ZoneStats::Scope zone_scope_; }; PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info, ZoneStats* zone_stats) { PipelineStatistics* pipeline_statistics = nullptr; if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { pipeline_statistics = new PipelineStatistics(info, zone_stats); pipeline_statistics->BeginPhaseKind("initializing"); } if (FLAG_trace_turbo) { TurboJsonFile json_of(info, std::ios_base::trunc); Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
code_ = Handle::null(); // All objects in the following group of fields are allocated in graph_zone_. // They are all set to nullptr when the graph_zone_ is destroyed. ZoneStats::Scope graph_zone_scope_; Zone* graph_zone_ = nullptr; Graph* graph_ = nullptr; SourcePositionTable* source_positions_ = nullptr; LoopAssignmentAnalysis* loop_assignment_ = nullptr; SimplifiedOperatorBuilder* simplified_ = nullptr; MachineOperatorBuilder* machine_ = nullptr; CommonOperatorBuilder* common_ = nullptr; JSOperatorBuilder* javascript_ = nullptr; JSGraph* jsgraph_ = nullptr; Schedule* schedule_ = nullptr; // All objects in the following group of fields are allocated in // instruction_zone_. They are all set to nullptr when the instruction_zone_ // is // destroyed. ZoneStats::Scope instruction_zone_scope_; Zone* instruction_zone_; InstructionSequence* sequence_ = nullptr; Frame* frame_ = nullptr; // All objects in the following group of fields are allocated in // register_allocation_zone_. They are all set to nullptr when the zone is // destroyed. ZoneStats::Scope register_allocation_zone_scope_; Zone* register_allocation_zone_; RegisterAllocationData* register_allocation_data_ = nullptr; // Basic block profiling support. BasicBlockProfiler::Data* profiler_data_ = nullptr; // Source position output for --trace-turbo. std::string source_position_output_; ZoneVector* protected_instructions_ = nullptr; DISALLOW_COPY_AND_ASSIGN(PipelineData); }; class PipelineImpl final { public: explicit PipelineImpl(PipelineData* data) : data_(data) {} // Helpers for executing pipeline phases. template void Run(); template void Run(Arg0 arg_0); template void Run(Arg0 arg_0, Arg1 arg_1); // Run the graph creation and initial optimization passes. bool CreateGraph(); // Run the concurrent optimization passes. bool OptimizeGraph(Linkage* linkage); // Perform the actual code generation and return handle to a code object. Handle GenerateCode(Linkage* linkage); bool ScheduleAndSelectInstructions(Linkage* linkage, bool trim_graph); void RunPrintAndVerify(const char* phase, bool untyped = false); Handle ScheduleAndGenerateCode(CallDescriptor* call_descriptor); void AllocateRegisters(const RegisterConfiguration* config, CallDescriptor* descriptor, bool run_verifier); CompilationInfo* info() const; Isolate* isolate() const; PipelineData* const data_; }; namespace { struct TurboCfgFile : public std::ofstream { explicit TurboCfgFile(Isolate* isolate) : std::ofstream(isolate->GetTurboCfgFileName().c_str(), std::ios_base::app) {} }; struct TurboJsonFile : public std::ofstream { TurboJsonFile(CompilationInfo* info, std::ios_base::openmode mode) : std::ofstream(GetVisualizerLogFileName(info, nullptr, "json").get(), mode) {} }; void TraceSchedule(CompilationInfo* info, Schedule* schedule) { if (FLAG_trace_turbo) { AllowHandleDereference allow_deref; TurboJsonFile json_of(info, std::ios_base::app); json_of << "{\"name\":\"Schedule\",\"type\":\"schedule\",\"data\":\""; std::stringstream schedule_stream; schedule_stream << *schedule; std::string schedule_string(schedule_stream.str()); for (const auto& c : schedule_string) { json_of << AsEscapedUC16ForJSON(c); } json_of << "\"},\n"; } if (FLAG_trace_turbo_graph || FLAG_trace_turbo_scheduler) { AllowHandleDereference allow_deref; CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); OFStream os(tracing_scope.file()); os << "-- Schedule --------------------------------------\n" << *schedule; } } class SourcePositionWrapper final : public Reducer { public: SourcePositionWrapper(Reducer* reducer, SourcePositionTable* table) : reducer_(reducer), table_(table) {} ~SourcePositionWrapper() final {} Reduction Reduce(Node* node) final { SourcePosition const pos = table_->GetSourcePosition(node); SourcePositionTable::Scope position(table_, pos); return reducer_->Reduce(node); } void Finalize() final { reducer_->Finalize(); } private: Reducer* const reducer_; SourcePositionTable* const table_; DISALLOW_COPY_AND_ASSIGN(SourcePositionWrapper); }; class JSGraphReducer final : public GraphReducer { public: JSGraphReducer(JSGraph* jsgraph, Zone* zone) : GraphReducer(zone, jsgraph->graph(), jsgraph->Dead()) {} ~JSGraphReducer() final {} }; void AddReducer(PipelineData* data, GraphReducer* graph_reducer, Reducer* reducer) { if (data->info()->is_source_positions_enabled()) { void* const buffer = data->graph_zone()->New(sizeof(SourcePositionWrapper)); SourcePositionWrapper* const wrapper = new (buffer) SourcePositionWrapper(reducer, data->source_positions()); graph_reducer->AddReducer(wrapper); } else { graph_reducer->AddReducer(reducer); } } class PipelineRunScope { public: PipelineRunScope(PipelineData* data, const char* phase_name) : phase_scope_( phase_name == nullptr ? nullptr : data->pipeline_statistics(), phase_name), zone_scope_(data->zone_stats(), ZONE_NAME) {} Zone* zone() { return zone_scope_.zone(); } private: PhaseScope phase_scope_; ZoneStats::Scope zone_scope_; }; PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info, ZoneStats* zone_stats) { PipelineStatistics* pipeline_statistics = nullptr; if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { pipeline_statistics = new PipelineStatistics(info, zone_stats); pipeline_statistics->BeginPhaseKind("initializing"); } if (FLAG_trace_turbo) { TurboJsonFile json_of(info, std::ios_base::trunc); Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
::null(); // All objects in the following group of fields are allocated in graph_zone_. // They are all set to nullptr when the graph_zone_ is destroyed. ZoneStats::Scope graph_zone_scope_; Zone* graph_zone_ = nullptr; Graph* graph_ = nullptr; SourcePositionTable* source_positions_ = nullptr; LoopAssignmentAnalysis* loop_assignment_ = nullptr; SimplifiedOperatorBuilder* simplified_ = nullptr; MachineOperatorBuilder* machine_ = nullptr; CommonOperatorBuilder* common_ = nullptr; JSOperatorBuilder* javascript_ = nullptr; JSGraph* jsgraph_ = nullptr; Schedule* schedule_ = nullptr; // All objects in the following group of fields are allocated in // instruction_zone_. They are all set to nullptr when the instruction_zone_ // is // destroyed. ZoneStats::Scope instruction_zone_scope_; Zone* instruction_zone_; InstructionSequence* sequence_ = nullptr; Frame* frame_ = nullptr; // All objects in the following group of fields are allocated in // register_allocation_zone_. They are all set to nullptr when the zone is // destroyed. ZoneStats::Scope register_allocation_zone_scope_; Zone* register_allocation_zone_; RegisterAllocationData* register_allocation_data_ = nullptr; // Basic block profiling support. BasicBlockProfiler::Data* profiler_data_ = nullptr; // Source position output for --trace-turbo. std::string source_position_output_; ZoneVector* protected_instructions_ = nullptr; DISALLOW_COPY_AND_ASSIGN(PipelineData); }; class PipelineImpl final { public: explicit PipelineImpl(PipelineData* data) : data_(data) {} // Helpers for executing pipeline phases. template void Run(); template void Run(Arg0 arg_0); template void Run(Arg0 arg_0, Arg1 arg_1); // Run the graph creation and initial optimization passes. bool CreateGraph(); // Run the concurrent optimization passes. bool OptimizeGraph(Linkage* linkage); // Perform the actual code generation and return handle to a code object. Handle GenerateCode(Linkage* linkage); bool ScheduleAndSelectInstructions(Linkage* linkage, bool trim_graph); void RunPrintAndVerify(const char* phase, bool untyped = false); Handle ScheduleAndGenerateCode(CallDescriptor* call_descriptor); void AllocateRegisters(const RegisterConfiguration* config, CallDescriptor* descriptor, bool run_verifier); CompilationInfo* info() const; Isolate* isolate() const; PipelineData* const data_; }; namespace { struct TurboCfgFile : public std::ofstream { explicit TurboCfgFile(Isolate* isolate) : std::ofstream(isolate->GetTurboCfgFileName().c_str(), std::ios_base::app) {} }; struct TurboJsonFile : public std::ofstream { TurboJsonFile(CompilationInfo* info, std::ios_base::openmode mode) : std::ofstream(GetVisualizerLogFileName(info, nullptr, "json").get(), mode) {} }; void TraceSchedule(CompilationInfo* info, Schedule* schedule) { if (FLAG_trace_turbo) { AllowHandleDereference allow_deref; TurboJsonFile json_of(info, std::ios_base::app); json_of << "{\"name\":\"Schedule\",\"type\":\"schedule\",\"data\":\""; std::stringstream schedule_stream; schedule_stream << *schedule; std::string schedule_string(schedule_stream.str()); for (const auto& c : schedule_string) { json_of << AsEscapedUC16ForJSON(c); } json_of << "\"},\n"; } if (FLAG_trace_turbo_graph || FLAG_trace_turbo_scheduler) { AllowHandleDereference allow_deref; CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); OFStream os(tracing_scope.file()); os << "-- Schedule --------------------------------------\n" << *schedule; } } class SourcePositionWrapper final : public Reducer { public: SourcePositionWrapper(Reducer* reducer, SourcePositionTable* table) : reducer_(reducer), table_(table) {} ~SourcePositionWrapper() final {} Reduction Reduce(Node* node) final { SourcePosition const pos = table_->GetSourcePosition(node); SourcePositionTable::Scope position(table_, pos); return reducer_->Reduce(node); } void Finalize() final { reducer_->Finalize(); } private: Reducer* const reducer_; SourcePositionTable* const table_; DISALLOW_COPY_AND_ASSIGN(SourcePositionWrapper); }; class JSGraphReducer final : public GraphReducer { public: JSGraphReducer(JSGraph* jsgraph, Zone* zone) : GraphReducer(zone, jsgraph->graph(), jsgraph->Dead()) {} ~JSGraphReducer() final {} }; void AddReducer(PipelineData* data, GraphReducer* graph_reducer, Reducer* reducer) { if (data->info()->is_source_positions_enabled()) { void* const buffer = data->graph_zone()->New(sizeof(SourcePositionWrapper)); SourcePositionWrapper* const wrapper = new (buffer) SourcePositionWrapper(reducer, data->source_positions()); graph_reducer->AddReducer(wrapper); } else { graph_reducer->AddReducer(reducer); } } class PipelineRunScope { public: PipelineRunScope(PipelineData* data, const char* phase_name) : phase_scope_( phase_name == nullptr ? nullptr : data->pipeline_statistics(), phase_name), zone_scope_(data->zone_stats(), ZONE_NAME) {} Zone* zone() { return zone_scope_.zone(); } private: PhaseScope phase_scope_; ZoneStats::Scope zone_scope_; }; PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info, ZoneStats* zone_stats) { PipelineStatistics* pipeline_statistics = nullptr; if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { pipeline_statistics = new PipelineStatistics(info, zone_stats); pipeline_statistics->BeginPhaseKind("initializing"); } if (FLAG_trace_turbo) { TurboJsonFile json_of(info, std::ios_base::trunc); Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
GenerateCode(Linkage* linkage); bool ScheduleAndSelectInstructions(Linkage* linkage, bool trim_graph); void RunPrintAndVerify(const char* phase, bool untyped = false); Handle ScheduleAndGenerateCode(CallDescriptor* call_descriptor); void AllocateRegisters(const RegisterConfiguration* config, CallDescriptor* descriptor, bool run_verifier); CompilationInfo* info() const; Isolate* isolate() const; PipelineData* const data_; }; namespace { struct TurboCfgFile : public std::ofstream { explicit TurboCfgFile(Isolate* isolate) : std::ofstream(isolate->GetTurboCfgFileName().c_str(), std::ios_base::app) {} }; struct TurboJsonFile : public std::ofstream { TurboJsonFile(CompilationInfo* info, std::ios_base::openmode mode) : std::ofstream(GetVisualizerLogFileName(info, nullptr, "json").get(), mode) {} }; void TraceSchedule(CompilationInfo* info, Schedule* schedule) { if (FLAG_trace_turbo) { AllowHandleDereference allow_deref; TurboJsonFile json_of(info, std::ios_base::app); json_of << "{\"name\":\"Schedule\",\"type\":\"schedule\",\"data\":\""; std::stringstream schedule_stream; schedule_stream << *schedule; std::string schedule_string(schedule_stream.str()); for (const auto& c : schedule_string) { json_of << AsEscapedUC16ForJSON(c); } json_of << "\"},\n"; } if (FLAG_trace_turbo_graph || FLAG_trace_turbo_scheduler) { AllowHandleDereference allow_deref; CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); OFStream os(tracing_scope.file()); os << "-- Schedule --------------------------------------\n" << *schedule; } } class SourcePositionWrapper final : public Reducer { public: SourcePositionWrapper(Reducer* reducer, SourcePositionTable* table) : reducer_(reducer), table_(table) {} ~SourcePositionWrapper() final {} Reduction Reduce(Node* node) final { SourcePosition const pos = table_->GetSourcePosition(node); SourcePositionTable::Scope position(table_, pos); return reducer_->Reduce(node); } void Finalize() final { reducer_->Finalize(); } private: Reducer* const reducer_; SourcePositionTable* const table_; DISALLOW_COPY_AND_ASSIGN(SourcePositionWrapper); }; class JSGraphReducer final : public GraphReducer { public: JSGraphReducer(JSGraph* jsgraph, Zone* zone) : GraphReducer(zone, jsgraph->graph(), jsgraph->Dead()) {} ~JSGraphReducer() final {} }; void AddReducer(PipelineData* data, GraphReducer* graph_reducer, Reducer* reducer) { if (data->info()->is_source_positions_enabled()) { void* const buffer = data->graph_zone()->New(sizeof(SourcePositionWrapper)); SourcePositionWrapper* const wrapper = new (buffer) SourcePositionWrapper(reducer, data->source_positions()); graph_reducer->AddReducer(wrapper); } else { graph_reducer->AddReducer(reducer); } } class PipelineRunScope { public: PipelineRunScope(PipelineData* data, const char* phase_name) : phase_scope_( phase_name == nullptr ? nullptr : data->pipeline_statistics(), phase_name), zone_scope_(data->zone_stats(), ZONE_NAME) {} Zone* zone() { return zone_scope_.zone(); } private: PhaseScope phase_scope_; ZoneStats::Scope zone_scope_; }; PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info, ZoneStats* zone_stats) { PipelineStatistics* pipeline_statistics = nullptr; if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { pipeline_statistics = new PipelineStatistics(info, zone_stats); pipeline_statistics->BeginPhaseKind("initializing"); } if (FLAG_trace_turbo) { TurboJsonFile json_of(info, std::ios_base::trunc); Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
ScheduleAndGenerateCode(CallDescriptor* call_descriptor); void AllocateRegisters(const RegisterConfiguration* config, CallDescriptor* descriptor, bool run_verifier); CompilationInfo* info() const; Isolate* isolate() const; PipelineData* const data_; }; namespace { struct TurboCfgFile : public std::ofstream { explicit TurboCfgFile(Isolate* isolate) : std::ofstream(isolate->GetTurboCfgFileName().c_str(), std::ios_base::app) {} }; struct TurboJsonFile : public std::ofstream { TurboJsonFile(CompilationInfo* info, std::ios_base::openmode mode) : std::ofstream(GetVisualizerLogFileName(info, nullptr, "json").get(), mode) {} }; void TraceSchedule(CompilationInfo* info, Schedule* schedule) { if (FLAG_trace_turbo) { AllowHandleDereference allow_deref; TurboJsonFile json_of(info, std::ios_base::app); json_of << "{\"name\":\"Schedule\",\"type\":\"schedule\",\"data\":\""; std::stringstream schedule_stream; schedule_stream << *schedule; std::string schedule_string(schedule_stream.str()); for (const auto& c : schedule_string) { json_of << AsEscapedUC16ForJSON(c); } json_of << "\"},\n"; } if (FLAG_trace_turbo_graph || FLAG_trace_turbo_scheduler) { AllowHandleDereference allow_deref; CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); OFStream os(tracing_scope.file()); os << "-- Schedule --------------------------------------\n" << *schedule; } } class SourcePositionWrapper final : public Reducer { public: SourcePositionWrapper(Reducer* reducer, SourcePositionTable* table) : reducer_(reducer), table_(table) {} ~SourcePositionWrapper() final {} Reduction Reduce(Node* node) final { SourcePosition const pos = table_->GetSourcePosition(node); SourcePositionTable::Scope position(table_, pos); return reducer_->Reduce(node); } void Finalize() final { reducer_->Finalize(); } private: Reducer* const reducer_; SourcePositionTable* const table_; DISALLOW_COPY_AND_ASSIGN(SourcePositionWrapper); }; class JSGraphReducer final : public GraphReducer { public: JSGraphReducer(JSGraph* jsgraph, Zone* zone) : GraphReducer(zone, jsgraph->graph(), jsgraph->Dead()) {} ~JSGraphReducer() final {} }; void AddReducer(PipelineData* data, GraphReducer* graph_reducer, Reducer* reducer) { if (data->info()->is_source_positions_enabled()) { void* const buffer = data->graph_zone()->New(sizeof(SourcePositionWrapper)); SourcePositionWrapper* const wrapper = new (buffer) SourcePositionWrapper(reducer, data->source_positions()); graph_reducer->AddReducer(wrapper); } else { graph_reducer->AddReducer(reducer); } } class PipelineRunScope { public: PipelineRunScope(PipelineData* data, const char* phase_name) : phase_scope_( phase_name == nullptr ? nullptr : data->pipeline_statistics(), phase_name), zone_scope_(data->zone_stats(), ZONE_NAME) {} Zone* zone() { return zone_scope_.zone(); } private: PhaseScope phase_scope_; ZoneStats::Scope zone_scope_; }; PipelineStatistics* CreatePipelineStatistics(CompilationInfo* info, ZoneStats* zone_stats) { PipelineStatistics* pipeline_statistics = nullptr; if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { pipeline_statistics = new PipelineStatistics(info, zone_stats); pipeline_statistics->BeginPhaseKind("initializing"); } if (FLAG_trace_turbo) { TurboJsonFile json_of(info, std::ios_base::trunc); Handle 登录后可以享受更多权益 您还没有登录,登录后您可以: 收藏Android系统代码 收藏喜欢的文章 多个平台共享账号 去登录 首次使用?从这里 注册
您还没有登录,登录后您可以:
首次使用?从这里 注册