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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 DECLARE_FLAG(bool, background_compilation); | 67 DECLARE_FLAG(bool, background_compilation); |
68 DECLARE_FLAG(bool, load_deferred_eagerly); | 68 DECLARE_FLAG(bool, load_deferred_eagerly); |
69 DECLARE_FLAG(bool, trace_failed_optimization_attempts); | 69 DECLARE_FLAG(bool, trace_failed_optimization_attempts); |
70 DECLARE_FLAG(bool, trace_inlining_intervals); | 70 DECLARE_FLAG(bool, trace_inlining_intervals); |
71 DECLARE_FLAG(bool, trace_irregexp); | 71 DECLARE_FLAG(bool, trace_irregexp); |
72 | 72 |
73 | 73 |
74 bool Compiler::always_optimize_ = false; | 74 bool Compiler::always_optimize_ = false; |
75 bool Compiler::allow_recompilation_ = true; | 75 bool Compiler::allow_recompilation_ = true; |
76 | 76 |
77 #ifndef DART_PRECOMPILED | |
77 | 78 |
78 // TODO(zerny): Factor out unoptimizing/optimizing pipelines and remove | 79 // TODO(zerny): Factor out unoptimizing/optimizing pipelines and remove |
79 // separate helpers functions & `optimizing` args. | 80 // separate helpers functions & `optimizing` args. |
80 class CompilationPipeline : public ZoneAllocated { | 81 class CompilationPipeline : public ZoneAllocated { |
81 public: | 82 public: |
82 static CompilationPipeline* New(Zone* zone, const Function& function); | 83 static CompilationPipeline* New(Zone* zone, const Function& function); |
83 | 84 |
84 virtual void ParseFunction(ParsedFunction* parsed_function) = 0; | 85 virtual void ParseFunction(ParsedFunction* parsed_function) = 0; |
85 virtual FlowGraph* BuildFlowGraph( | 86 virtual FlowGraph* BuildFlowGraph( |
86 Zone* zone, | 87 Zone* zone, |
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1903 | 1904 |
1904 | 1905 |
1905 void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) { | 1906 void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) { |
1906 function_queue_->VisitObjectPointers(visitor); | 1907 function_queue_->VisitObjectPointers(visitor); |
1907 result_queue_->VisitObjectPointers(visitor); | 1908 result_queue_->VisitObjectPointers(visitor); |
1908 } | 1909 } |
1909 | 1910 |
1910 | 1911 |
1911 void BackgroundCompiler::Stop(BackgroundCompiler* task) { | 1912 void BackgroundCompiler::Stop(BackgroundCompiler* task) { |
1912 ASSERT(Isolate::Current()->background_compiler() == task); | 1913 ASSERT(Isolate::Current()->background_compiler() == task); |
1913 if (task == NULL) { | 1914 ASSERT(task != NULL); |
1914 return; | |
1915 } | |
1916 BackgroundCompilationQueue* function_queue = task->function_queue(); | 1915 BackgroundCompilationQueue* function_queue = task->function_queue(); |
1917 BackgroundCompilationQueue* result_queue = task->result_queue(); | 1916 BackgroundCompilationQueue* result_queue = task->result_queue(); |
1918 | 1917 |
1919 Monitor* queue_monitor = task->queue_monitor_; | 1918 Monitor* queue_monitor = task->queue_monitor_; |
1920 Monitor* done_monitor = task->done_monitor_; | 1919 Monitor* done_monitor = task->done_monitor_; |
1921 bool* task_done = task->done_; | 1920 bool* task_done = task->done_; |
1922 // Wake up compiler task and stop it. | 1921 // Wake up compiler task and stop it. |
1923 { | 1922 { |
1924 MonitorLocker ml(task->queue_monitor_); | 1923 MonitorLocker ml(task->queue_monitor_); |
1925 task->running_ = false; | 1924 task->running_ = false; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1964 BackgroundCompiler* task = new BackgroundCompiler(isolate); | 1963 BackgroundCompiler* task = new BackgroundCompiler(isolate); |
1965 isolate->set_background_compiler(task); | 1964 isolate->set_background_compiler(task); |
1966 start_task = true; | 1965 start_task = true; |
1967 } | 1966 } |
1968 } | 1967 } |
1969 if (start_task) { | 1968 if (start_task) { |
1970 Dart::thread_pool()->Run(isolate->background_compiler()); | 1969 Dart::thread_pool()->Run(isolate->background_compiler()); |
1971 } | 1970 } |
1972 } | 1971 } |
1973 | 1972 |
1973 | |
1974 #else | |
rmacnak
2015/11/17 20:51:18
#else // DART_PRECOMPILED
Florian Schneider
2015/11/18 11:44:08
Done.
| |
1975 | |
1976 | |
1977 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { | |
1978 UNREACHABLE(); | |
1979 } | |
1980 | |
1981 | |
1982 bool Compiler::IsBackgroundCompilation() { | |
1983 return false; | |
rmacnak
2015/11/17 20:51:18
UNREACHABLE()
Florian Schneider
2015/11/18 11:44:09
Done.
| |
1984 } | |
1985 | |
1986 | |
1987 RawError* Compiler::Compile(const Library& library, const Script& script) { | |
1988 UNREACHABLE(); | |
1989 return Error::null(); | |
1990 } | |
1991 | |
1992 | |
1993 RawError* Compiler::CompileClass(const Class& cls) { | |
1994 UNREACHABLE(); | |
1995 return Error::null(); | |
1996 } | |
1997 | |
1998 | |
1999 RawError* Compiler::CompileFunction(Thread* thread, | |
2000 const Function& function) { | |
2001 UNREACHABLE(); | |
2002 return Error::null(); | |
2003 } | |
2004 | |
2005 | |
2006 RawError* Compiler::EnsureUnoptimizedCode(Thread* thread, | |
2007 const Function& function) { | |
2008 UNREACHABLE(); | |
2009 return Error::null(); | |
2010 } | |
2011 | |
2012 | |
2013 RawError* Compiler::CompileOptimizedFunction(Thread* thread, | |
2014 const Function& function, | |
2015 intptr_t osr_id, | |
2016 BackgroundCompilationResult* res) { | |
2017 UNREACHABLE(); | |
2018 return Error::null(); | |
2019 } | |
2020 | |
2021 | |
2022 RawError* Compiler::CompileParsedFunction( | |
2023 ParsedFunction* parsed_function) { | |
2024 UNREACHABLE(); | |
2025 return Error::null(); | |
2026 } | |
2027 | |
2028 | |
2029 void Compiler::ComputeLocalVarDescriptors(const Code& code) { | |
2030 UNREACHABLE(); | |
2031 } | |
2032 | |
2033 | |
2034 RawError* Compiler::CompileAllFunctions(const Class& cls) { | |
2035 UNREACHABLE(); | |
2036 return Error::null(); | |
2037 } | |
2038 | |
2039 | |
2040 void Compiler::CompileStaticInitializer(const Field& field) { | |
2041 UNREACHABLE(); | |
2042 } | |
2043 | |
2044 | |
2045 RawObject* Compiler::EvaluateStaticInitializer(const Field& field) { | |
2046 ASSERT(field.HasPrecompiledInitializer()); | |
2047 const Function& initializer = | |
2048 Function::Handle(field.PrecompiledInitializer()); | |
2049 return DartEntry::InvokeFunction(initializer, Object::empty_array()); | |
2050 } | |
2051 | |
2052 | |
2053 | |
2054 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { | |
2055 UNREACHABLE(); | |
2056 return Object::null(); | |
2057 } | |
2058 | |
2059 | |
2060 void BackgroundCompiler::CompileOptimized(const Function& function) { | |
2061 UNREACHABLE(); | |
2062 } | |
2063 | |
2064 | |
2065 void BackgroundCompiler::InstallGeneratedCode() { | |
2066 UNREACHABLE(); | |
2067 } | |
2068 | |
2069 | |
2070 void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) { | |
2071 UNREACHABLE(); | |
2072 } | |
2073 | |
2074 | |
2075 void BackgroundCompiler::Stop(BackgroundCompiler* task) { | |
2076 UNREACHABLE(); | |
2077 } | |
2078 | |
2079 | |
2080 void BackgroundCompiler::EnsureInit(Thread* thread) { | |
2081 UNREACHABLE(); | |
2082 } | |
2083 | |
2084 #endif // DART_PRECOMPILED | |
2085 | |
1974 } // namespace dart | 2086 } // namespace dart |
OLD | NEW |