OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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.h" | 5 #include "src/compiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/ast/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 DCHECK(job->last_status() != OptimizedCompileJob::SUCCEEDED); | 1850 DCHECK(job->last_status() != OptimizedCompileJob::SUCCEEDED); |
1851 if (FLAG_trace_opt) { | 1851 if (FLAG_trace_opt) { |
1852 PrintF("[aborted optimizing "); | 1852 PrintF("[aborted optimizing "); |
1853 info->closure()->ShortPrint(); | 1853 info->closure()->ShortPrint(); |
1854 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); | 1854 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); |
1855 } | 1855 } |
1856 return MaybeHandle<Code>(); | 1856 return MaybeHandle<Code>(); |
1857 } | 1857 } |
1858 | 1858 |
1859 | 1859 |
1860 CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info) | |
1861 : name_(name), info_(info) { | |
1862 if (FLAG_hydrogen_stats) { | |
1863 info_zone_start_allocation_size_ = info->zone()->allocation_size(); | |
1864 timer_.Start(); | |
1865 } | |
1866 } | |
1867 | |
1868 | |
1869 CompilationPhase::~CompilationPhase() { | |
1870 if (FLAG_hydrogen_stats) { | |
1871 size_t size = zone()->allocation_size(); | |
1872 size += info_->zone()->allocation_size() - info_zone_start_allocation_size_; | |
1873 isolate()->GetHStatistics()->SaveTiming(name_, timer_.Elapsed(), size); | |
1874 } | |
1875 } | |
1876 | |
1877 | |
1878 bool CompilationPhase::ShouldProduceTraceOutput() const { | |
1879 // Trace if the appropriate trace flag is set and the phase name's first | |
1880 // character is in the FLAG_trace_phase command line parameter. | |
1881 AllowHandleDereference allow_deref; | |
1882 bool tracing_on = info()->IsStub() | |
1883 ? FLAG_trace_hydrogen_stubs | |
1884 : (FLAG_trace_hydrogen && | |
1885 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | |
1886 return (tracing_on && | |
1887 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | |
1888 } | |
1889 | |
1890 #if DEBUG | 1860 #if DEBUG |
1891 void CompilationInfo::PrintAstForTesting() { | 1861 void CompilationInfo::PrintAstForTesting() { |
1892 PrintF("--- Source from AST ---\n%s\n", | 1862 PrintF("--- Source from AST ---\n%s\n", |
1893 PrettyPrinter(isolate()).PrintProgram(literal())); | 1863 PrettyPrinter(isolate()).PrintProgram(literal())); |
1894 } | 1864 } |
1895 #endif | 1865 #endif |
| 1866 |
1896 } // namespace internal | 1867 } // namespace internal |
1897 } // namespace v8 | 1868 } // namespace v8 |
OLD | NEW |