Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(664)

Unified Diff: src/compiler/pipeline.cc

Issue 1105363003: [turbofan] Don't spread global flag checks all over the compiler code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index e07ce7691f3b4e55c3c58667f116581a5809e6eb..92a0be6203c0e47b99d7ee9d19fa128cd68604c3 100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -312,6 +312,8 @@ class PipelineData {
};
+namespace {
+
struct TurboCfgFile : public std::ofstream {
explicit TurboCfgFile(Isolate* isolate)
: std::ofstream(isolate->GetTurboCfgFileName().c_str(),
@@ -319,7 +321,7 @@ struct TurboCfgFile : public std::ofstream {
};
-static void TraceSchedule(CompilationInfo* info, Schedule* schedule) {
+void TraceSchedule(CompilationInfo* info, Schedule* schedule) {
if (FLAG_trace_turbo) {
FILE* json_file = OpenVisualizerLogFile(info, NULL, "json", "a+");
if (json_file != nullptr) {
@@ -341,7 +343,7 @@ static void TraceSchedule(CompilationInfo* info, Schedule* schedule) {
}
-static SmartArrayPointer<char> GetDebugName(CompilationInfo* info) {
+SmartArrayPointer<char> GetDebugName(CompilationInfo* info) {
if (info->code_stub() != NULL) {
CodeStub::Major major_key = info->code_stub()->MajorKey();
const char* major_name = CodeStub::MajorName(major_key, false);
@@ -356,7 +358,7 @@ static SmartArrayPointer<char> GetDebugName(CompilationInfo* info) {
}
-class AstGraphBuilderWithPositions : public AstGraphBuilder {
+class AstGraphBuilderWithPositions final : public AstGraphBuilder {
public:
AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info,
JSGraph* jsgraph,
@@ -383,45 +385,43 @@ class AstGraphBuilderWithPositions : public AstGraphBuilder {
#undef DEF_VISIT
private:
- SourcePositionTable* source_positions_;
- SourcePosition start_position_;
+ SourcePositionTable* const source_positions_;
+ SourcePosition const start_position_;
};
-namespace {
-
-class SourcePositionWrapper : public Reducer {
+class SourcePositionWrapper final : public Reducer {
public:
SourcePositionWrapper(Reducer* reducer, SourcePositionTable* table)
: reducer_(reducer), table_(table) {}
- virtual ~SourcePositionWrapper() {}
+ ~SourcePositionWrapper() final {}
- virtual Reduction Reduce(Node* node) {
- SourcePosition pos = table_->GetSourcePosition(node);
+ Reduction Reduce(Node* node) final {
+ SourcePosition const pos = table_->GetSourcePosition(node);
SourcePositionTable::Scope position(table_, pos);
return reducer_->Reduce(node);
}
private:
- Reducer* reducer_;
- SourcePositionTable* table_;
+ Reducer* const reducer_;
+ SourcePositionTable* const table_;
DISALLOW_COPY_AND_ASSIGN(SourcePositionWrapper);
};
-static void AddReducer(PipelineData* data, GraphReducer* graph_reducer,
- Reducer* reducer) {
- if (FLAG_turbo_source_positions) {
- void* buffer = data->graph_zone()->New(sizeof(SourcePositionWrapper));
- SourcePositionWrapper* wrapper =
+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);
}
}
-} // namespace
+
class PipelineRunScope {
public:
@@ -438,6 +438,8 @@ class PipelineRunScope {
ZonePool::Scope zone_scope_;
};
+} // namespace
+
template <typename Phase>
void Pipeline::Run() {
@@ -712,9 +714,12 @@ struct InstructionSelectionPhase {
static const char* phase_name() { return "select instructions"; }
void Run(PipelineData* data, Zone* temp_zone, Linkage* linkage) {
- InstructionSelector selector(temp_zone, data->graph()->NodeCount(), linkage,
- data->sequence(), data->schedule(),
- data->source_positions());
+ InstructionSelector selector(
+ temp_zone, data->graph()->NodeCount(), linkage, data->sequence(),
+ data->schedule(), data->source_positions(),
+ data->info()->is_source_positions_enabled()
+ ? InstructionSelector::kAllSourcePositions
+ : InstructionSelector::kCallSourcePositions);
selector.SelectInstructions();
}
};
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698