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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 function.raw()); | 1102 function.raw()); |
1103 } | 1103 } |
1104 } | 1104 } |
1105 ) | 1105 ) |
1106 | 1106 |
1107 static RawError* CompileFunctionHelper(CompilationPipeline* pipeline, | 1107 static RawError* CompileFunctionHelper(CompilationPipeline* pipeline, |
1108 const Function& function, | 1108 const Function& function, |
1109 bool optimized, | 1109 bool optimized, |
1110 intptr_t osr_id) { | 1110 intptr_t osr_id) { |
1111 ASSERT(!FLAG_precompiled_mode); | 1111 ASSERT(!FLAG_precompiled_mode); |
| 1112 ASSERT(!optimized || function.was_compiled()); |
1112 LongJumpScope jump; | 1113 LongJumpScope jump; |
1113 if (setjmp(*jump.Set()) == 0) { | 1114 if (setjmp(*jump.Set()) == 0) { |
1114 Thread* const thread = Thread::Current(); | 1115 Thread* const thread = Thread::Current(); |
1115 Isolate* const isolate = thread->isolate(); | 1116 Isolate* const isolate = thread->isolate(); |
1116 StackZone stack_zone(thread); | 1117 StackZone stack_zone(thread); |
1117 Zone* const zone = stack_zone.GetZone(); | 1118 Zone* const zone = stack_zone.GetZone(); |
1118 const bool trace_compiler = | 1119 const bool trace_compiler = |
1119 FLAG_trace_compiler || | 1120 FLAG_trace_compiler || |
1120 (FLAG_trace_optimizing_compiler && optimized); | 1121 (FLAG_trace_optimizing_compiler && optimized); |
1121 Timer per_compile_timer(trace_compiler, "Compilation time"); | 1122 Timer per_compile_timer(trace_compiler, "Compilation time"); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 if (isolate->IsTopLevelParsing() || | 1159 if (isolate->IsTopLevelParsing() || |
1159 (loading_invalidation_gen_at_start != | 1160 (loading_invalidation_gen_at_start != |
1160 isolate->loading_invalidation_gen())) { | 1161 isolate->loading_invalidation_gen())) { |
1161 // Loading occured while parsing. We need to abort here because state | 1162 // Loading occured while parsing. We need to abort here because state |
1162 // changed while compiling. | 1163 // changed while compiling. |
1163 Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId); | 1164 Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId); |
1164 } | 1165 } |
1165 } | 1166 } |
1166 | 1167 |
1167 const bool success = helper.Compile(pipeline); | 1168 const bool success = helper.Compile(pipeline); |
1168 if (!success) { | 1169 if (success) { |
| 1170 if (!optimized) { |
| 1171 function.set_was_compiled(true); |
| 1172 } |
| 1173 } else { |
1169 if (optimized) { | 1174 if (optimized) { |
1170 if (Compiler::IsBackgroundCompilation()) { | 1175 if (Compiler::IsBackgroundCompilation()) { |
1171 // Try again later, background compilation may abort because of | 1176 // Try again later, background compilation may abort because of |
1172 // state change during compilation. | 1177 // state change during compilation. |
1173 if (FLAG_trace_compiler) { | 1178 if (FLAG_trace_compiler) { |
1174 THR_Print("Aborted background compilation: %s\n", | 1179 THR_Print("Aborted background compilation: %s\n", |
1175 function.ToFullyQualifiedCString()); | 1180 function.ToFullyQualifiedCString()); |
1176 } | 1181 } |
1177 return Error::null(); | 1182 return Error::null(); |
1178 } | 1183 } |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 } | 1919 } |
1915 | 1920 |
1916 | 1921 |
1917 void BackgroundCompiler::EnsureInit(Thread* thread) { | 1922 void BackgroundCompiler::EnsureInit(Thread* thread) { |
1918 UNREACHABLE(); | 1923 UNREACHABLE(); |
1919 } | 1924 } |
1920 | 1925 |
1921 #endif // DART_PRECOMPILED_RUNTIME | 1926 #endif // DART_PRECOMPILED_RUNTIME |
1922 | 1927 |
1923 } // namespace dart | 1928 } // namespace dart |
OLD | NEW |