OLD | NEW |
---|---|
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/precompiler.h" | 5 #include "vm/precompiler.h" |
6 | 6 |
7 #include "vm/aot_optimizer.h" | 7 #include "vm/aot_optimizer.h" |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
10 #include "vm/branch_optimizer.h" | 10 #include "vm/branch_optimizer.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 | 145 |
146 private: | 146 private: |
147 Zone* zone_; | 147 Zone* zone_; |
148 CompileType result_type_; | 148 CompileType result_type_; |
149 FieldTypeMap* field_map_; | 149 FieldTypeMap* field_map_; |
150 }; | 150 }; |
151 | 151 |
152 | 152 |
153 class PrecompileParsedFunctionHelper : public ValueObject { | 153 class PrecompileParsedFunctionHelper : public ValueObject { |
154 public: | 154 public: |
155 PrecompileParsedFunctionHelper(ParsedFunction* parsed_function, | 155 PrecompileParsedFunctionHelper(Precompiler* precompiler, |
156 ParsedFunction* parsed_function, | |
156 bool optimized) | 157 bool optimized) |
157 : parsed_function_(parsed_function), | 158 : precompiler_(precompiler), |
159 parsed_function_(parsed_function), | |
158 optimized_(optimized), | 160 optimized_(optimized), |
159 thread_(Thread::Current()) { | 161 thread_(Thread::Current()) { |
160 } | 162 } |
161 | 163 |
162 bool Compile(CompilationPipeline* pipeline); | 164 bool Compile(CompilationPipeline* pipeline); |
163 | 165 |
164 private: | 166 private: |
165 ParsedFunction* parsed_function() const { return parsed_function_; } | 167 ParsedFunction* parsed_function() const { return parsed_function_; } |
166 bool optimized() const { return optimized_; } | 168 bool optimized() const { return optimized_; } |
167 Thread* thread() const { return thread_; } | 169 Thread* thread() const { return thread_; } |
168 Isolate* isolate() const { return thread_->isolate(); } | 170 Isolate* isolate() const { return thread_->isolate(); } |
169 | 171 |
170 void FinalizeCompilation(Assembler* assembler, | 172 void FinalizeCompilation(Assembler* assembler, |
171 FlowGraphCompiler* graph_compiler, | 173 FlowGraphCompiler* graph_compiler, |
172 FlowGraph* flow_graph); | 174 FlowGraph* flow_graph); |
173 | 175 |
176 Precompiler* precompiler_; | |
174 ParsedFunction* parsed_function_; | 177 ParsedFunction* parsed_function_; |
175 const bool optimized_; | 178 const bool optimized_; |
176 Thread* const thread_; | 179 Thread* const thread_; |
177 | 180 |
178 DISALLOW_COPY_AND_ASSIGN(PrecompileParsedFunctionHelper); | 181 DISALLOW_COPY_AND_ASSIGN(PrecompileParsedFunctionHelper); |
179 }; | 182 }; |
180 | 183 |
181 | 184 |
182 static void Jump(const Error& error) { | 185 static void Jump(const Error& error) { |
183 Thread::Current()->long_jump_base()->Jump(1, error); | 186 Thread::Current()->long_jump_base()->Jump(1, error); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
307 GrowableObjectArray::Handle(GrowableObjectArray::New())), | 310 GrowableObjectArray::Handle(GrowableObjectArray::New())), |
308 sent_selectors_(), | 311 sent_selectors_(), |
309 enqueued_functions_(), | 312 enqueued_functions_(), |
310 fields_to_retain_(), | 313 fields_to_retain_(), |
311 functions_to_retain_(), | 314 functions_to_retain_(), |
312 classes_to_retain_(), | 315 classes_to_retain_(), |
313 typeargs_to_retain_(), | 316 typeargs_to_retain_(), |
314 types_to_retain_(), | 317 types_to_retain_(), |
315 consts_to_retain_(), | 318 consts_to_retain_(), |
316 field_type_map_(), | 319 field_type_map_(), |
317 error_(Error::Handle()) { | 320 error_(Error::Handle()), |
321 get_runtime_type_is_unique_(false) { | |
318 } | 322 } |
319 | 323 |
320 | 324 |
321 void Precompiler::DoCompileAll( | 325 void Precompiler::DoCompileAll( |
322 Dart_QualifiedFunctionName embedder_entry_points[]) { | 326 Dart_QualifiedFunctionName embedder_entry_points[]) { |
323 ASSERT(I->compilation_allowed()); | 327 ASSERT(I->compilation_allowed()); |
324 | 328 |
325 { | 329 { |
326 StackZone stack_zone(T); | 330 StackZone stack_zone(T); |
327 zone_ = stack_zone.GetZone(); | 331 zone_ = stack_zone.GetZone(); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 | 480 |
477 HANDLESCOPE(T); | 481 HANDLESCOPE(T); |
478 StaticInitializerVisitor visitor(Z); | 482 StaticInitializerVisitor visitor(Z); |
479 VisitClasses(&visitor); | 483 VisitClasses(&visitor); |
480 } | 484 } |
481 | 485 |
482 | 486 |
483 void Precompiler::PrecompileConstructors() { | 487 void Precompiler::PrecompileConstructors() { |
484 class ConstructorVisitor : public FunctionVisitor { | 488 class ConstructorVisitor : public FunctionVisitor { |
485 public: | 489 public: |
486 explicit ConstructorVisitor(Zone* zone, FieldTypeMap* map) | 490 explicit ConstructorVisitor(Precompiler* precompiler, Zone* zone) |
487 : zone_(zone), field_type_map_(map) { | 491 : precompiler_(precompiler), zone_(zone) { |
488 ASSERT(map != NULL); | |
489 } | 492 } |
490 void Visit(const Function& function) { | 493 void Visit(const Function& function) { |
491 if (!function.IsGenerativeConstructor()) return; | 494 if (!function.IsGenerativeConstructor()) return; |
492 if (function.HasCode()) { | 495 if (function.HasCode()) { |
493 // Const constructors may have been visited before. Recompile them here | 496 // Const constructors may have been visited before. Recompile them here |
494 // to collect type information for final fields for them as well. | 497 // to collect type information for final fields for them as well. |
495 function.ClearCode(); | 498 function.ClearCode(); |
496 } | 499 } |
497 if (FLAG_trace_precompiler) { | 500 if (FLAG_trace_precompiler) { |
498 THR_Print("Precompiling constructor %s\n", function.ToCString()); | 501 THR_Print("Precompiling constructor %s\n", function.ToCString()); |
499 } | 502 } |
500 CompileFunction(Thread::Current(), | 503 CompileFunction(precompiler_, |
504 Thread::Current(), | |
501 zone_, | 505 zone_, |
502 function, | 506 function); |
503 field_type_map_); | |
504 } | 507 } |
508 | |
505 private: | 509 private: |
510 Precompiler* precompiler_; | |
506 Zone* zone_; | 511 Zone* zone_; |
507 FieldTypeMap* field_type_map_; | |
508 }; | 512 }; |
509 | 513 |
510 HANDLESCOPE(T); | 514 HANDLESCOPE(T); |
511 ConstructorVisitor visitor(zone_, &field_type_map_); | 515 ConstructorVisitor visitor(this, zone_); |
512 VisitFunctions(&visitor); | 516 VisitFunctions(&visitor); |
513 | 517 |
514 FieldTypeMap::Iterator it(field_type_map_.GetIterator()); | 518 FieldTypeMap::Iterator it(field_type_map_.GetIterator()); |
515 for (FieldTypePair* current = it.Next(); | 519 for (FieldTypePair* current = it.Next(); |
516 current != NULL; | 520 current != NULL; |
517 current = it.Next()) { | 521 current = it.Next()) { |
518 const intptr_t cid = current->cid_; | 522 const intptr_t cid = current->cid_; |
519 current->field_->set_guarded_cid(cid); | 523 current->field_->set_guarded_cid(cid); |
520 current->field_->set_is_nullable(cid == kNullCid || cid == kDynamicCid); | 524 current->field_->set_is_nullable(cid == kNullCid || cid == kDynamicCid); |
521 if (FLAG_trace_precompiler) { | 525 if (FLAG_trace_precompiler) { |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
789 THR_Print("Precompiling %" Pd " %s (%s, %s)\n", | 793 THR_Print("Precompiling %" Pd " %s (%s, %s)\n", |
790 function_count_, | 794 function_count_, |
791 function.ToLibNamePrefixedQualifiedCString(), | 795 function.ToLibNamePrefixedQualifiedCString(), |
792 function.token_pos().ToCString(), | 796 function.token_pos().ToCString(), |
793 Function::KindToCString(function.kind())); | 797 Function::KindToCString(function.kind())); |
794 } | 798 } |
795 | 799 |
796 ASSERT(!function.is_abstract()); | 800 ASSERT(!function.is_abstract()); |
797 ASSERT(!function.IsRedirectingFactory()); | 801 ASSERT(!function.IsRedirectingFactory()); |
798 | 802 |
799 error_ = CompileFunction(thread_, zone_, function); | 803 error_ = CompileFunction(this, thread_, zone_, function); |
800 if (!error_.IsNull()) { | 804 if (!error_.IsNull()) { |
801 Jump(error_); | 805 Jump(error_); |
802 } | 806 } |
803 // Used in the JIT to save type-feedback across compilations. | 807 // Used in the JIT to save type-feedback across compilations. |
804 function.ClearICDataArray(); | 808 function.ClearICDataArray(); |
805 } else { | 809 } else { |
806 if (FLAG_trace_precompiler) { | 810 if (FLAG_trace_precompiler) { |
807 // This function was compiled from somewhere other than Precompiler, | 811 // This function was compiled from somewhere other than Precompiler, |
808 // such as const constructors compiled by the parser. | 812 // such as const constructors compiled by the parser. |
809 THR_Print("Already has code: %s (%s, %s)\n", | 813 THR_Print("Already has code: %s (%s, %s)\n", |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1127 RawFunction* Precompiler::CompileStaticInitializer(const Field& field, | 1131 RawFunction* Precompiler::CompileStaticInitializer(const Field& field, |
1128 bool compute_type) { | 1132 bool compute_type) { |
1129 ASSERT(field.is_static()); | 1133 ASSERT(field.is_static()); |
1130 Thread* thread = Thread::Current(); | 1134 Thread* thread = Thread::Current(); |
1131 StackZone zone(thread); | 1135 StackZone zone(thread); |
1132 | 1136 |
1133 ParsedFunction* parsed_function = Parser::ParseStaticFieldInitializer(field); | 1137 ParsedFunction* parsed_function = Parser::ParseStaticFieldInitializer(field); |
1134 | 1138 |
1135 parsed_function->AllocateVariables(); | 1139 parsed_function->AllocateVariables(); |
1136 DartPrecompilationPipeline pipeline(zone.GetZone()); | 1140 DartPrecompilationPipeline pipeline(zone.GetZone()); |
1137 PrecompileParsedFunctionHelper helper(parsed_function, | 1141 PrecompileParsedFunctionHelper helper(/* precompiler = */ NULL, |
1142 parsed_function, | |
1138 /* optimized = */ true); | 1143 /* optimized = */ true); |
1139 bool success = helper.Compile(&pipeline); | 1144 bool success = helper.Compile(&pipeline); |
1140 ASSERT(success); | 1145 ASSERT(success); |
1141 | 1146 |
1142 if (compute_type && field.is_final()) { | 1147 if (compute_type && field.is_final()) { |
1143 intptr_t result_cid = pipeline.result_type().ToCid(); | 1148 intptr_t result_cid = pipeline.result_type().ToCid(); |
1144 if (result_cid != kDynamicCid) { | 1149 if (result_cid != kDynamicCid) { |
1145 if (FLAG_trace_precompiler && FLAG_support_il_printer) { | 1150 if (FLAG_trace_precompiler && FLAG_support_il_printer) { |
1146 THR_Print("Setting guarded_cid of %s to %s\n", field.ToCString(), | 1151 THR_Print("Setting guarded_cid of %s to %s\n", field.ToCString(), |
1147 pipeline.result_type().ToCString()); | 1152 pipeline.result_type().ToCString()); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1228 // here. | 1233 // here. |
1229 ParsedFunction* parsed_function = new ParsedFunction(thread, func); | 1234 ParsedFunction* parsed_function = new ParsedFunction(thread, func); |
1230 parsed_function->SetNodeSequence(fragment); | 1235 parsed_function->SetNodeSequence(fragment); |
1231 fragment->scope()->AddVariable(parsed_function->EnsureExpressionTemp()); | 1236 fragment->scope()->AddVariable(parsed_function->EnsureExpressionTemp()); |
1232 fragment->scope()->AddVariable( | 1237 fragment->scope()->AddVariable( |
1233 parsed_function->current_context_var()); | 1238 parsed_function->current_context_var()); |
1234 parsed_function->AllocateVariables(); | 1239 parsed_function->AllocateVariables(); |
1235 | 1240 |
1236 // Non-optimized code generator. | 1241 // Non-optimized code generator. |
1237 DartPrecompilationPipeline pipeline(Thread::Current()->zone()); | 1242 DartPrecompilationPipeline pipeline(Thread::Current()->zone()); |
1238 PrecompileParsedFunctionHelper helper(parsed_function, | 1243 PrecompileParsedFunctionHelper helper(/* precompiler = */ NULL, |
1244 parsed_function, | |
1239 /* optimized = */ false); | 1245 /* optimized = */ false); |
1240 helper.Compile(&pipeline); | 1246 helper.Compile(&pipeline); |
1241 Code::Handle(func.unoptimized_code()).set_var_descriptors( | 1247 Code::Handle(func.unoptimized_code()).set_var_descriptors( |
1242 Object::empty_var_descriptors()); | 1248 Object::empty_var_descriptors()); |
1243 | 1249 |
1244 const Object& result = PassiveObject::Handle( | 1250 const Object& result = PassiveObject::Handle( |
1245 DartEntry::InvokeFunction(func, Object::empty_array())); | 1251 DartEntry::InvokeFunction(func, Object::empty_array())); |
1246 return result.raw(); | 1252 return result.raw(); |
1247 } else { | 1253 } else { |
1248 Thread* const thread = Thread::Current(); | 1254 Thread* const thread = Thread::Current(); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1507 ASSERT(!farray.IsNull()); | 1513 ASSERT(!farray.IsNull()); |
1508 if (farray.Length() == 1) { | 1514 if (farray.Length() == 1) { |
1509 function ^= farray.At(0); | 1515 function ^= farray.At(0); |
1510 cls = function.Owner(); | 1516 cls = function.Owner(); |
1511 if (!CHA::IsImplemented(cls) && !CHA::HasSubclasses(cls)) { | 1517 if (!CHA::IsImplemented(cls) && !CHA::HasSubclasses(cls)) { |
1512 functions_set.Insert(function); | 1518 functions_set.Insert(function); |
1513 } | 1519 } |
1514 } | 1520 } |
1515 } | 1521 } |
1516 | 1522 |
1523 farray ^= table.GetOrNull(Symbols::GetRuntimeType()); | |
1524 | |
1525 get_runtime_type_is_unique_ = !farray.IsNull() && (farray.Length() == 1); | |
Florian Schneider
2016/09/29 18:03:29
Use CHA? Also can be used in JIT then.
Vyacheslav Egorov (Google)
2016/09/30 09:56:28
CHA does not track subclasses of Object - because
| |
1526 | |
1517 if (FLAG_print_unique_targets) { | 1527 if (FLAG_print_unique_targets) { |
1518 UniqueFunctionsSet::Iterator unique_iter(&functions_set); | 1528 UniqueFunctionsSet::Iterator unique_iter(&functions_set); |
1519 while (unique_iter.MoveNext()) { | 1529 while (unique_iter.MoveNext()) { |
1520 intptr_t curr_key = unique_iter.Current(); | 1530 intptr_t curr_key = unique_iter.Current(); |
1521 function ^= functions_set.GetKey(curr_key); | 1531 function ^= functions_set.GetKey(curr_key); |
1522 THR_Print("* %s\n", function.ToQualifiedCString()); | 1532 THR_Print("* %s\n", function.ToQualifiedCString()); |
1523 } | 1533 } |
1524 THR_Print("%" Pd " of %" Pd " dynamic selectors are unique\n", | 1534 THR_Print("%" Pd " of %" Pd " dynamic selectors are unique\n", |
1525 functions_set.NumOccupied(), table.NumOccupied()); | 1535 functions_set.NumOccupied(), table.NumOccupied()); |
1526 } | 1536 } |
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2816 // We do not add the token position now because we don't know the | 2826 // We do not add the token position now because we don't know the |
2817 // position of the inlined call until later. A side effect of this | 2827 // position of the inlined call until later. A side effect of this |
2818 // is that the length of |inline_id_to_function| is always larger | 2828 // is that the length of |inline_id_to_function| is always larger |
2819 // than the length of |inline_id_to_token_pos| by one. | 2829 // than the length of |inline_id_to_token_pos| by one. |
2820 // Top scope function has no caller (-1). We do this because we expect | 2830 // Top scope function has no caller (-1). We do this because we expect |
2821 // all token positions to be at an inlined call. | 2831 // all token positions to be at an inlined call. |
2822 // Top scope function has no caller (-1). | 2832 // Top scope function has no caller (-1). |
2823 caller_inline_id.Add(-1); | 2833 caller_inline_id.Add(-1); |
2824 CSTAT_TIMER_SCOPE(thread(), graphoptimizer_timer); | 2834 CSTAT_TIMER_SCOPE(thread(), graphoptimizer_timer); |
2825 | 2835 |
2826 AotOptimizer optimizer(flow_graph, | 2836 AotOptimizer optimizer(precompiler_, |
2837 flow_graph, | |
2827 use_speculative_inlining, | 2838 use_speculative_inlining, |
2828 &inlining_black_list); | 2839 &inlining_black_list); |
2829 optimizer.PopulateWithICData(); | 2840 optimizer.PopulateWithICData(); |
2830 | 2841 |
2831 optimizer.ApplyClassIds(); | 2842 optimizer.ApplyClassIds(); |
2832 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 2843 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
2833 | 2844 |
2834 FlowGraphTypePropagator::Propagate(flow_graph); | 2845 FlowGraphTypePropagator::Propagate(flow_graph); |
2835 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 2846 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
2836 | 2847 |
(...skipping 21 matching lines...) Expand all Loading... | |
2858 | 2869 |
2859 // Use propagated class-ids to create more inlining opportunities. | 2870 // Use propagated class-ids to create more inlining opportunities. |
2860 optimizer.ApplyClassIds(); | 2871 optimizer.ApplyClassIds(); |
2861 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 2872 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
2862 | 2873 |
2863 FlowGraphInliner inliner(flow_graph, | 2874 FlowGraphInliner inliner(flow_graph, |
2864 &inline_id_to_function, | 2875 &inline_id_to_function, |
2865 &inline_id_to_token_pos, | 2876 &inline_id_to_token_pos, |
2866 &caller_inline_id, | 2877 &caller_inline_id, |
2867 use_speculative_inlining, | 2878 use_speculative_inlining, |
2868 &inlining_black_list); | 2879 &inlining_black_list, |
2880 precompiler_); | |
2869 inliner.Inline(); | 2881 inliner.Inline(); |
2870 // Use lists are maintained and validated by the inliner. | 2882 // Use lists are maintained and validated by the inliner. |
2871 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 2883 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
2872 } | 2884 } |
2873 | 2885 |
2874 // Propagate types and eliminate more type tests. | 2886 // Propagate types and eliminate more type tests. |
2875 FlowGraphTypePropagator::Propagate(flow_graph); | 2887 FlowGraphTypePropagator::Propagate(flow_graph); |
2876 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 2888 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
2877 | 2889 |
2878 { | 2890 { |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3237 } | 3249 } |
3238 is_compiled = false; | 3250 is_compiled = false; |
3239 } | 3251 } |
3240 // Reset global isolate state. | 3252 // Reset global isolate state. |
3241 thread()->set_deopt_id(prev_deopt_id); | 3253 thread()->set_deopt_id(prev_deopt_id); |
3242 } | 3254 } |
3243 return is_compiled; | 3255 return is_compiled; |
3244 } | 3256 } |
3245 | 3257 |
3246 | 3258 |
3247 static RawError* PrecompileFunctionHelper(CompilationPipeline* pipeline, | 3259 static RawError* PrecompileFunctionHelper(Precompiler* precompiler, |
3260 CompilationPipeline* pipeline, | |
3248 const Function& function, | 3261 const Function& function, |
3249 bool optimized) { | 3262 bool optimized) { |
3250 // Check that we optimize, except if the function is not optimizable. | 3263 // Check that we optimize, except if the function is not optimizable. |
3251 ASSERT(FLAG_precompiled_mode); | 3264 ASSERT(FLAG_precompiled_mode); |
3252 ASSERT(!function.IsOptimizable() || optimized); | 3265 ASSERT(!function.IsOptimizable() || optimized); |
3253 ASSERT(!function.HasCode()); | 3266 ASSERT(!function.HasCode()); |
3254 LongJumpScope jump; | 3267 LongJumpScope jump; |
3255 if (setjmp(*jump.Set()) == 0) { | 3268 if (setjmp(*jump.Set()) == 0) { |
3256 Thread* const thread = Thread::Current(); | 3269 Thread* const thread = Thread::Current(); |
3257 StackZone stack_zone(thread); | 3270 StackZone stack_zone(thread); |
(...skipping 21 matching lines...) Expand all Loading... | |
3279 { | 3292 { |
3280 HANDLESCOPE(thread); | 3293 HANDLESCOPE(thread); |
3281 const int64_t num_tokens_before = STAT_VALUE(thread, num_tokens_consumed); | 3294 const int64_t num_tokens_before = STAT_VALUE(thread, num_tokens_consumed); |
3282 pipeline->ParseFunction(parsed_function); | 3295 pipeline->ParseFunction(parsed_function); |
3283 const int64_t num_tokens_after = STAT_VALUE(thread, num_tokens_consumed); | 3296 const int64_t num_tokens_after = STAT_VALUE(thread, num_tokens_consumed); |
3284 INC_STAT(thread, | 3297 INC_STAT(thread, |
3285 num_func_tokens_compiled, | 3298 num_func_tokens_compiled, |
3286 num_tokens_after - num_tokens_before); | 3299 num_tokens_after - num_tokens_before); |
3287 } | 3300 } |
3288 | 3301 |
3289 PrecompileParsedFunctionHelper helper(parsed_function, optimized); | 3302 PrecompileParsedFunctionHelper helper( |
3303 precompiler, parsed_function, optimized); | |
3290 const bool success = helper.Compile(pipeline); | 3304 const bool success = helper.Compile(pipeline); |
3291 if (!success) { | 3305 if (!success) { |
3292 // Encountered error. | 3306 // Encountered error. |
3293 Error& error = Error::Handle(); | 3307 Error& error = Error::Handle(); |
3294 // We got an error during compilation. | 3308 // We got an error during compilation. |
3295 error = thread->sticky_error(); | 3309 error = thread->sticky_error(); |
3296 thread->clear_sticky_error(); | 3310 thread->clear_sticky_error(); |
3297 ASSERT(error.IsLanguageError() && | 3311 ASSERT(error.IsLanguageError() && |
3298 LanguageError::Cast(error).kind() != Report::kBailout); | 3312 LanguageError::Cast(error).kind() != Report::kBailout); |
3299 return error.raw(); | 3313 return error.raw(); |
(...skipping 27 matching lines...) Expand all Loading... | |
3327 // Precompilation may encounter compile-time errors. | 3341 // Precompilation may encounter compile-time errors. |
3328 // Do not attempt to optimize functions that can cause errors. | 3342 // Do not attempt to optimize functions that can cause errors. |
3329 function.set_is_optimizable(false); | 3343 function.set_is_optimizable(false); |
3330 return error.raw(); | 3344 return error.raw(); |
3331 } | 3345 } |
3332 UNREACHABLE(); | 3346 UNREACHABLE(); |
3333 return Error::null(); | 3347 return Error::null(); |
3334 } | 3348 } |
3335 | 3349 |
3336 | 3350 |
3337 RawError* Precompiler::CompileFunction(Thread* thread, | 3351 RawError* Precompiler::CompileFunction(Precompiler* precompiler, |
3352 Thread* thread, | |
3338 Zone* zone, | 3353 Zone* zone, |
3339 const Function& function, | 3354 const Function& function) { |
3340 FieldTypeMap* field_type_map) { | |
3341 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); | 3355 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); |
3342 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, "CompileFunction", function); | 3356 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, "CompileFunction", function); |
3343 | 3357 |
3344 ASSERT(FLAG_precompiled_mode); | 3358 ASSERT(FLAG_precompiled_mode); |
3345 const bool optimized = function.IsOptimizable(); // False for natives. | 3359 const bool optimized = function.IsOptimizable(); // False for natives. |
3346 DartPrecompilationPipeline pipeline(zone, field_type_map); | 3360 DartPrecompilationPipeline pipeline(zone, |
3347 return PrecompileFunctionHelper(&pipeline, function, optimized); | 3361 (precompiler != NULL) ? precompiler->field_type_map() : NULL); |
3362 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized); | |
3348 } | 3363 } |
3349 | 3364 |
3350 #endif // DART_PRECOMPILER | 3365 #endif // DART_PRECOMPILER |
3351 | 3366 |
3352 } // namespace dart | 3367 } // namespace dart |
OLD | NEW |