OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/compiler.h" | 5 #include "vm/compiler.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 | 8 |
9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
10 #include "vm/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 DECLARE_FLAG(bool, background_compilation); | 70 DECLARE_FLAG(bool, background_compilation); |
71 DECLARE_FLAG(bool, load_deferred_eagerly); | 71 DECLARE_FLAG(bool, load_deferred_eagerly); |
72 DECLARE_FLAG(bool, trace_failed_optimization_attempts); | 72 DECLARE_FLAG(bool, trace_failed_optimization_attempts); |
73 DECLARE_FLAG(bool, trace_inlining_intervals); | 73 DECLARE_FLAG(bool, trace_inlining_intervals); |
74 DECLARE_FLAG(bool, trace_irregexp); | 74 DECLARE_FLAG(bool, trace_irregexp); |
75 | 75 |
76 | 76 |
77 bool Compiler::always_optimize_ = false; | 77 bool Compiler::always_optimize_ = false; |
78 bool Compiler::allow_recompilation_ = true; | 78 bool Compiler::allow_recompilation_ = true; |
79 | 79 |
80 #ifndef DART_PRECOMPILED | |
Ivan Posva
2015/11/20 05:14:50
if !defined(DART_PRECOMPILED)
| |
80 | 81 |
81 // TODO(zerny): Factor out unoptimizing/optimizing pipelines and remove | 82 // TODO(zerny): Factor out unoptimizing/optimizing pipelines and remove |
82 // separate helpers functions & `optimizing` args. | 83 // separate helpers functions & `optimizing` args. |
83 class CompilationPipeline : public ZoneAllocated { | 84 class CompilationPipeline : public ZoneAllocated { |
84 public: | 85 public: |
85 static CompilationPipeline* New(Zone* zone, const Function& function); | 86 static CompilationPipeline* New(Zone* zone, const Function& function); |
86 | 87 |
87 virtual void ParseFunction(ParsedFunction* parsed_function) = 0; | 88 virtual void ParseFunction(ParsedFunction* parsed_function) = 0; |
88 virtual FlowGraph* BuildFlowGraph( | 89 virtual FlowGraph* BuildFlowGraph( |
89 Zone* zone, | 90 Zone* zone, |
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1724 } | 1725 } |
1725 | 1726 |
1726 | 1727 |
1727 void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) { | 1728 void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) { |
1728 function_queue_->VisitObjectPointers(visitor); | 1729 function_queue_->VisitObjectPointers(visitor); |
1729 } | 1730 } |
1730 | 1731 |
1731 | 1732 |
1732 void BackgroundCompiler::Stop(BackgroundCompiler* task) { | 1733 void BackgroundCompiler::Stop(BackgroundCompiler* task) { |
1733 ASSERT(Isolate::Current()->background_compiler() == task); | 1734 ASSERT(Isolate::Current()->background_compiler() == task); |
1734 if (task == NULL) { | 1735 ASSERT(task != NULL); |
1735 return; | |
1736 } | |
1737 BackgroundCompilationQueue* function_queue = task->function_queue(); | 1736 BackgroundCompilationQueue* function_queue = task->function_queue(); |
1738 | 1737 |
1739 Monitor* queue_monitor = task->queue_monitor_; | 1738 Monitor* queue_monitor = task->queue_monitor_; |
1740 Monitor* done_monitor = task->done_monitor_; | 1739 Monitor* done_monitor = task->done_monitor_; |
1741 bool* task_done = task->done_; | 1740 bool* task_done = task->done_; |
1742 // Wake up compiler task and stop it. | 1741 // Wake up compiler task and stop it. |
1743 { | 1742 { |
1744 MonitorLocker ml(task->queue_monitor_); | 1743 MonitorLocker ml(task->queue_monitor_); |
1745 task->running_ = false; | 1744 task->running_ = false; |
1746 // 'task' will be deleted by thread pool. | 1745 // 'task' will be deleted by thread pool. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1785 BackgroundCompiler* task = new BackgroundCompiler(isolate); | 1784 BackgroundCompiler* task = new BackgroundCompiler(isolate); |
1786 isolate->set_background_compiler(task); | 1785 isolate->set_background_compiler(task); |
1787 start_task = true; | 1786 start_task = true; |
1788 } | 1787 } |
1789 } | 1788 } |
1790 if (start_task) { | 1789 if (start_task) { |
1791 Dart::thread_pool()->Run(isolate->background_compiler()); | 1790 Dart::thread_pool()->Run(isolate->background_compiler()); |
1792 } | 1791 } |
1793 } | 1792 } |
1794 | 1793 |
1794 | |
1795 #else // DART_PRECOMPILED | |
1796 | |
1797 | |
1798 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { | |
1799 UNREACHABLE(); | |
1800 } | |
1801 | |
1802 | |
1803 bool Compiler::IsBackgroundCompilation() { | |
1804 UNREACHABLE(); | |
1805 return false; | |
1806 } | |
1807 | |
1808 | |
1809 RawError* Compiler::Compile(const Library& library, const Script& script) { | |
1810 UNREACHABLE(); | |
1811 return Error::null(); | |
1812 } | |
1813 | |
1814 | |
1815 RawError* Compiler::CompileClass(const Class& cls) { | |
1816 UNREACHABLE(); | |
1817 return Error::null(); | |
1818 } | |
1819 | |
1820 | |
1821 RawError* Compiler::CompileFunction(Thread* thread, | |
1822 const Function& function) { | |
1823 UNREACHABLE(); | |
1824 return Error::null(); | |
1825 } | |
1826 | |
1827 | |
1828 RawError* Compiler::EnsureUnoptimizedCode(Thread* thread, | |
1829 const Function& function) { | |
1830 UNREACHABLE(); | |
1831 return Error::null(); | |
1832 } | |
1833 | |
1834 | |
1835 RawError* Compiler::CompileOptimizedFunction(Thread* thread, | |
1836 const Function& function, | |
1837 intptr_t osr_id) { | |
1838 UNREACHABLE(); | |
1839 return Error::null(); | |
1840 } | |
1841 | |
1842 | |
1843 RawError* Compiler::CompileParsedFunction( | |
1844 ParsedFunction* parsed_function) { | |
1845 UNREACHABLE(); | |
1846 return Error::null(); | |
1847 } | |
1848 | |
1849 | |
1850 void Compiler::ComputeLocalVarDescriptors(const Code& code) { | |
1851 UNREACHABLE(); | |
1852 } | |
1853 | |
1854 | |
1855 RawError* Compiler::CompileAllFunctions(const Class& cls) { | |
1856 UNREACHABLE(); | |
1857 return Error::null(); | |
1858 } | |
1859 | |
1860 | |
1861 void Compiler::CompileStaticInitializer(const Field& field) { | |
1862 UNREACHABLE(); | |
1863 } | |
1864 | |
1865 | |
1866 RawObject* Compiler::EvaluateStaticInitializer(const Field& field) { | |
1867 ASSERT(field.HasPrecompiledInitializer()); | |
1868 const Function& initializer = | |
1869 Function::Handle(field.PrecompiledInitializer()); | |
1870 return DartEntry::InvokeFunction(initializer, Object::empty_array()); | |
1871 } | |
1872 | |
1873 | |
1874 | |
1875 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { | |
1876 UNREACHABLE(); | |
1877 return Object::null(); | |
1878 } | |
1879 | |
1880 | |
1881 void BackgroundCompiler::CompileOptimized(const Function& function) { | |
1882 UNREACHABLE(); | |
1883 } | |
1884 | |
1885 | |
1886 void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) { | |
1887 UNREACHABLE(); | |
1888 } | |
1889 | |
1890 | |
1891 void BackgroundCompiler::Stop(BackgroundCompiler* task) { | |
1892 UNREACHABLE(); | |
1893 } | |
1894 | |
1895 | |
1896 void BackgroundCompiler::EnsureInit(Thread* thread) { | |
1897 UNREACHABLE(); | |
1898 } | |
1899 | |
1900 #endif // DART_PRECOMPILED | |
1901 | |
1795 } // namespace dart | 1902 } // namespace dart |
OLD | NEW |