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 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 } | 1777 } |
1778 } else { | 1778 } else { |
1779 info->set_osr_frame(osr_frame); | 1779 info->set_osr_frame(osr_frame); |
1780 if (GetOptimizedCodeNow(info.get())) return info->code(); | 1780 if (GetOptimizedCodeNow(info.get())) return info->code(); |
1781 } | 1781 } |
1782 | 1782 |
1783 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); | 1783 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); |
1784 return MaybeHandle<Code>(); | 1784 return MaybeHandle<Code>(); |
1785 } | 1785 } |
1786 | 1786 |
1787 | 1787 MaybeHandle<Code> Compiler::GetConcurrentlyOptimizedCode( |
1788 Handle<Code> Compiler::GetConcurrentlyOptimizedCode(OptimizedCompileJob* job) { | 1788 OptimizedCompileJob* job) { |
1789 // Take ownership of compilation info. Deleting compilation info | 1789 // Take ownership of compilation info. Deleting compilation info |
1790 // also tears down the zone and the recompile job. | 1790 // also tears down the zone and the recompile job. |
1791 base::SmartPointer<CompilationInfo> info(job->info()); | 1791 base::SmartPointer<CompilationInfo> info(job->info()); |
1792 Isolate* isolate = info->isolate(); | 1792 Isolate* isolate = info->isolate(); |
1793 | 1793 |
1794 VMState<COMPILER> state(isolate); | 1794 VMState<COMPILER> state(isolate); |
1795 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); | 1795 TimerEventScope<TimerEventRecompileSynchronous> timer(info->isolate()); |
1796 | 1796 |
1797 Handle<SharedFunctionInfo> shared = info->shared_info(); | 1797 Handle<SharedFunctionInfo> shared = info->shared_info(); |
1798 shared->code()->set_profiler_ticks(0); | 1798 shared->code()->set_profiler_ticks(0); |
(...skipping 24 matching lines...) Expand all Loading... |
1823 return Handle<Code>(*info->code()); | 1823 return Handle<Code>(*info->code()); |
1824 } | 1824 } |
1825 } | 1825 } |
1826 | 1826 |
1827 DCHECK(job->last_status() != OptimizedCompileJob::SUCCEEDED); | 1827 DCHECK(job->last_status() != OptimizedCompileJob::SUCCEEDED); |
1828 if (FLAG_trace_opt) { | 1828 if (FLAG_trace_opt) { |
1829 PrintF("[aborted optimizing "); | 1829 PrintF("[aborted optimizing "); |
1830 info->closure()->ShortPrint(); | 1830 info->closure()->ShortPrint(); |
1831 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); | 1831 PrintF(" because: %s]\n", GetBailoutReason(info->bailout_reason())); |
1832 } | 1832 } |
1833 return Handle<Code>::null(); | 1833 return MaybeHandle<Code>(); |
1834 } | 1834 } |
1835 | 1835 |
1836 | 1836 |
1837 CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info) | 1837 CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info) |
1838 : name_(name), info_(info) { | 1838 : name_(name), info_(info) { |
1839 if (FLAG_hydrogen_stats) { | 1839 if (FLAG_hydrogen_stats) { |
1840 info_zone_start_allocation_size_ = info->zone()->allocation_size(); | 1840 info_zone_start_allocation_size_ = info->zone()->allocation_size(); |
1841 timer_.Start(); | 1841 timer_.Start(); |
1842 } | 1842 } |
1843 } | 1843 } |
(...skipping 21 matching lines...) Expand all Loading... |
1865 } | 1865 } |
1866 | 1866 |
1867 #if DEBUG | 1867 #if DEBUG |
1868 void CompilationInfo::PrintAstForTesting() { | 1868 void CompilationInfo::PrintAstForTesting() { |
1869 PrintF("--- Source from AST ---\n%s\n", | 1869 PrintF("--- Source from AST ---\n%s\n", |
1870 PrettyPrinter(isolate()).PrintProgram(literal())); | 1870 PrettyPrinter(isolate()).PrintProgram(literal())); |
1871 } | 1871 } |
1872 #endif | 1872 #endif |
1873 } // namespace internal | 1873 } // namespace internal |
1874 } // namespace v8 | 1874 } // namespace v8 |
OLD | NEW |