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

Side by Side Diff: src/compiler/pipeline.cc

Issue 1221103003: [turbofan] Move context specialization into JSContextSpecializer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix predicate. Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/pipeline.h" 5 #include "src/compiler/pipeline.h"
6 6
7 #include <fstream> // NOLINT(readability/streams) 7 #include <fstream> // NOLINT(readability/streams)
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/base/adapters.h" 10 #include "src/base/adapters.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info, 358 AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info,
359 JSGraph* jsgraph, 359 JSGraph* jsgraph,
360 LoopAssignmentAnalysis* loop_assignment, 360 LoopAssignmentAnalysis* loop_assignment,
361 JSTypeFeedbackTable* js_type_feedback, 361 JSTypeFeedbackTable* js_type_feedback,
362 SourcePositionTable* source_positions) 362 SourcePositionTable* source_positions)
363 : AstGraphBuilder(local_zone, info, jsgraph, loop_assignment, 363 : AstGraphBuilder(local_zone, info, jsgraph, loop_assignment,
364 js_type_feedback), 364 js_type_feedback),
365 source_positions_(source_positions), 365 source_positions_(source_positions),
366 start_position_(info->shared_info()->start_position()) {} 366 start_position_(info->shared_info()->start_position()) {}
367 367
368 bool CreateGraph(bool constant_context, bool stack_check) { 368 bool CreateGraph(bool stack_check) {
369 SourcePositionTable::Scope pos_scope(source_positions_, start_position_); 369 SourcePositionTable::Scope pos_scope(source_positions_, start_position_);
370 return AstGraphBuilder::CreateGraph(constant_context, stack_check); 370 return AstGraphBuilder::CreateGraph(stack_check);
371 } 371 }
372 372
373 #define DEF_VISIT(type) \ 373 #define DEF_VISIT(type) \
374 void Visit##type(type* node) override { \ 374 void Visit##type(type* node) override { \
375 SourcePositionTable::Scope pos(source_positions_, \ 375 SourcePositionTable::Scope pos(source_positions_, \
376 SourcePosition(node->position())); \ 376 SourcePosition(node->position())); \
377 AstGraphBuilder::Visit##type(node); \ 377 AstGraphBuilder::Visit##type(node); \
378 } 378 }
379 AST_NODE_LIST(DEF_VISIT) 379 AST_NODE_LIST(DEF_VISIT)
380 #undef DEF_VISIT 380 #undef DEF_VISIT
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 AstLoopAssignmentAnalyzer analyzer(data->graph_zone(), data->info()); 467 AstLoopAssignmentAnalyzer analyzer(data->graph_zone(), data->info());
468 LoopAssignmentAnalysis* loop_assignment = analyzer.Analyze(); 468 LoopAssignmentAnalysis* loop_assignment = analyzer.Analyze();
469 data->set_loop_assignment(loop_assignment); 469 data->set_loop_assignment(loop_assignment);
470 } 470 }
471 }; 471 };
472 472
473 473
474 struct GraphBuilderPhase { 474 struct GraphBuilderPhase {
475 static const char* phase_name() { return "graph builder"; } 475 static const char* phase_name() { return "graph builder"; }
476 476
477 void Run(PipelineData* data, Zone* temp_zone, bool constant_context) { 477 void Run(PipelineData* data, Zone* temp_zone) {
478 AstGraphBuilderWithPositions graph_builder( 478 AstGraphBuilderWithPositions graph_builder(
479 temp_zone, data->info(), data->jsgraph(), data->loop_assignment(), 479 temp_zone, data->info(), data->jsgraph(), data->loop_assignment(),
480 data->js_type_feedback(), data->source_positions()); 480 data->js_type_feedback(), data->source_positions());
481 bool stack_check = !data->info()->IsStub(); 481 bool stack_check = !data->info()->IsStub();
482 if (!graph_builder.CreateGraph(constant_context, stack_check)) { 482 if (!graph_builder.CreateGraph(stack_check)) {
483 data->set_compilation_failed(); 483 data->set_compilation_failed();
484 } 484 }
485 } 485 }
486 }; 486 };
487 487
488 488
489 struct InliningPhase { 489 struct InliningPhase {
490 static const char* phase_name() { return "inlining"; } 490 static const char* phase_name() { return "inlining"; }
491 491
492 void Run(PipelineData* data, Zone* temp_zone) { 492 void Run(PipelineData* data, Zone* temp_zone) {
493 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone); 493 JSGraphReducer graph_reducer(data->jsgraph(), temp_zone);
494 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), 494 DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
495 data->common()); 495 data->common());
496 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), 496 CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
497 data->common(), data->machine()); 497 data->common(), data->machine());
498 JSContextSpecializer context_specializer(&graph_reducer, data->jsgraph()); 498 JSContextSpecializer context_specializer(
499 &graph_reducer, data->jsgraph(),
500 data->info()->num_parameters_including_this(), data->info()->context());
499 JSInliner inliner(&graph_reducer, data->info()->is_inlining_enabled() 501 JSInliner inliner(&graph_reducer, data->info()->is_inlining_enabled()
500 ? JSInliner::kGeneralInlining 502 ? JSInliner::kGeneralInlining
501 : JSInliner::kRestrictedInlining, 503 : JSInliner::kRestrictedInlining,
502 temp_zone, data->info(), data->jsgraph()); 504 temp_zone, data->info(), data->jsgraph());
503 AddReducer(data, &graph_reducer, &dead_code_elimination); 505 AddReducer(data, &graph_reducer, &dead_code_elimination);
504 AddReducer(data, &graph_reducer, &common_reducer); 506 AddReducer(data, &graph_reducer, &common_reducer);
505 if (data->info()->is_context_specializing()) { 507 if (data->info()->is_context_specializing()) {
506 AddReducer(data, &graph_reducer, &context_specializer); 508 AddReducer(data, &graph_reducer, &context_specializer);
507 } 509 }
508 AddReducer(data, &graph_reducer, &inliner); 510 AddReducer(data, &graph_reducer, &inliner);
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 TurboCfgFile tcf(isolate()); 1026 TurboCfgFile tcf(isolate());
1025 tcf << AsC1VCompilation(info()); 1027 tcf << AsC1VCompilation(info());
1026 } 1028 }
1027 1029
1028 data.source_positions()->AddDecorator(); 1030 data.source_positions()->AddDecorator();
1029 1031
1030 if (FLAG_loop_assignment_analysis) { 1032 if (FLAG_loop_assignment_analysis) {
1031 Run<LoopAssignmentAnalysisPhase>(); 1033 Run<LoopAssignmentAnalysisPhase>();
1032 } 1034 }
1033 1035
1034 Run<GraphBuilderPhase>(info()->is_context_specializing()); 1036 Run<GraphBuilderPhase>();
1035 if (data.compilation_failed()) return Handle<Code>::null(); 1037 if (data.compilation_failed()) return Handle<Code>::null();
1036 RunPrintAndVerify("Initial untyped", true); 1038 RunPrintAndVerify("Initial untyped", true);
1037 1039
1038 // Perform context specialization and inlining (if enabled). 1040 // Perform context specialization and inlining (if enabled).
1039 Run<InliningPhase>(); 1041 Run<InliningPhase>();
1040 RunPrintAndVerify("Inlined", true); 1042 RunPrintAndVerify("Inlined", true);
1041 1043
1042 // Remove dead->live edges from the graph. 1044 // Remove dead->live edges from the graph.
1043 Run<EarlyGraphTrimmingPhase>(); 1045 Run<EarlyGraphTrimmingPhase>();
1044 RunPrintAndVerify("Early trimmed", true); 1046 RunPrintAndVerify("Early trimmed", true);
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 tcf << AsC1VRegisterAllocationData("CodeGen", 1357 tcf << AsC1VRegisterAllocationData("CodeGen",
1356 data->register_allocation_data()); 1358 data->register_allocation_data());
1357 } 1359 }
1358 1360
1359 data->DeleteRegisterAllocationZone(); 1361 data->DeleteRegisterAllocationZone();
1360 } 1362 }
1361 1363
1362 } // namespace compiler 1364 } // namespace compiler
1363 } // namespace internal 1365 } // namespace internal
1364 } // namespace v8 1366 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698