OLD | NEW |
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 <memory> | 8 #include <memory> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 struct OsrTyperPhase { | 861 struct OsrTyperPhase { |
862 static const char* phase_name() { return "osr typer"; } | 862 static const char* phase_name() { return "osr typer"; } |
863 | 863 |
864 void Run(PipelineData* data, Zone* temp_zone) { | 864 void Run(PipelineData* data, Zone* temp_zone) { |
865 NodeVector roots(temp_zone); | 865 NodeVector roots(temp_zone); |
866 data->jsgraph()->GetCachedNodes(&roots); | 866 data->jsgraph()->GetCachedNodes(&roots); |
867 // Dummy induction variable optimizer: at the moment, we do not try | 867 // Dummy induction variable optimizer: at the moment, we do not try |
868 // to compute loop variable bounds on OSR. | 868 // to compute loop variable bounds on OSR. |
869 LoopVariableOptimizer induction_vars(data->jsgraph()->graph(), | 869 LoopVariableOptimizer induction_vars(data->jsgraph()->graph(), |
870 data->common(), temp_zone); | 870 data->common(), temp_zone); |
871 Typer typer(data->isolate(), data->graph()); | 871 Typer typer(data->isolate(), Typer::kNoFlags, data->graph()); |
872 typer.Run(roots, &induction_vars); | 872 typer.Run(roots, &induction_vars); |
873 } | 873 } |
874 }; | 874 }; |
875 | 875 |
876 struct UntyperPhase { | 876 struct UntyperPhase { |
877 static const char* phase_name() { return "untyper"; } | 877 static const char* phase_name() { return "untyper"; } |
878 | 878 |
879 void Run(PipelineData* data, Zone* temp_zone) { | 879 void Run(PipelineData* data, Zone* temp_zone) { |
880 class RemoveTypeReducer final : public Reducer { | 880 class RemoveTypeReducer final : public Reducer { |
881 public: | 881 public: |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 Run<EarlyGraphTrimmingPhase>(); | 1538 Run<EarlyGraphTrimmingPhase>(); |
1539 RunPrintAndVerify("Early trimmed", true); | 1539 RunPrintAndVerify("Early trimmed", true); |
1540 | 1540 |
1541 if (FLAG_print_turbo_replay) { | 1541 if (FLAG_print_turbo_replay) { |
1542 // Print a replay of the initial graph. | 1542 // Print a replay of the initial graph. |
1543 GraphReplayPrinter::PrintReplay(data->graph()); | 1543 GraphReplayPrinter::PrintReplay(data->graph()); |
1544 } | 1544 } |
1545 | 1545 |
1546 // Run the type-sensitive lowerings and optimizations on the graph. | 1546 // Run the type-sensitive lowerings and optimizations on the graph. |
1547 { | 1547 { |
| 1548 // Determine the Typer operation flags. |
| 1549 Typer::Flags flags = Typer::kNoFlags; |
| 1550 if (is_sloppy(info()->shared_info()->language_mode()) && |
| 1551 !info()->shared_info()->IsBuiltin()) { |
| 1552 // Sloppy mode functions always have an Object for this. |
| 1553 flags |= Typer::kThisIsReceiver; |
| 1554 } |
| 1555 if (IsClassConstructor(info()->shared_info()->kind())) { |
| 1556 // Class constructors cannot be [[Call]]ed. |
| 1557 flags |= Typer::kNewTargetIsReceiver; |
| 1558 } |
| 1559 |
1548 // Type the graph and keep the Typer running on newly created nodes within | 1560 // Type the graph and keep the Typer running on newly created nodes within |
1549 // this scope; the Typer is automatically unlinked from the Graph once we | 1561 // this scope; the Typer is automatically unlinked from the Graph once we |
1550 // leave this scope below. | 1562 // leave this scope below. |
1551 Typer typer(isolate(), data->graph()); | 1563 Typer typer(isolate(), flags, data->graph()); |
1552 Run<TyperPhase>(&typer); | 1564 Run<TyperPhase>(&typer); |
1553 RunPrintAndVerify("Typed"); | 1565 RunPrintAndVerify("Typed"); |
1554 | 1566 |
1555 data->BeginPhaseKind("lowering"); | 1567 data->BeginPhaseKind("lowering"); |
1556 | 1568 |
1557 // Lower JSOperators where we can determine types. | 1569 // Lower JSOperators where we can determine types. |
1558 Run<TypedLoweringPhase>(); | 1570 Run<TypedLoweringPhase>(); |
1559 RunPrintAndVerify("Lowered typed"); | 1571 RunPrintAndVerify("Lowered typed"); |
1560 | 1572 |
1561 if (FLAG_turbo_loop_peeling) { | 1573 if (FLAG_turbo_loop_peeling) { |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1993 data->DeleteRegisterAllocationZone(); | 2005 data->DeleteRegisterAllocationZone(); |
1994 } | 2006 } |
1995 | 2007 |
1996 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 2008 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
1997 | 2009 |
1998 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 2010 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
1999 | 2011 |
2000 } // namespace compiler | 2012 } // namespace compiler |
2001 } // namespace internal | 2013 } // namespace internal |
2002 } // namespace v8 | 2014 } // namespace v8 |
OLD | NEW |