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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 key ^= table.GetKey(curr_key); | 1510 key ^= table.GetKey(curr_key); |
1505 farray ^= table.GetOrNull(key); | 1511 farray ^= table.GetOrNull(key); |
1506 ASSERT(!farray.IsNull()); | 1512 ASSERT(!farray.IsNull()); |
1507 if (farray.Length() == 1) { | 1513 if (farray.Length() == 1) { |
1508 function ^= farray.At(0); | 1514 function ^= farray.At(0); |
1509 cls = function.Owner(); | 1515 cls = function.Owner(); |
1510 functions_set.Insert(function); | 1516 functions_set.Insert(function); |
1511 } | 1517 } |
1512 } | 1518 } |
1513 | 1519 |
| 1520 farray ^= table.GetOrNull(Symbols::GetRuntimeType()); |
| 1521 |
| 1522 get_runtime_type_is_unique_ = !farray.IsNull() && (farray.Length() == 1); |
| 1523 |
1514 if (FLAG_print_unique_targets) { | 1524 if (FLAG_print_unique_targets) { |
1515 UniqueFunctionsSet::Iterator unique_iter(&functions_set); | 1525 UniqueFunctionsSet::Iterator unique_iter(&functions_set); |
1516 while (unique_iter.MoveNext()) { | 1526 while (unique_iter.MoveNext()) { |
1517 intptr_t curr_key = unique_iter.Current(); | 1527 intptr_t curr_key = unique_iter.Current(); |
1518 function ^= functions_set.GetKey(curr_key); | 1528 function ^= functions_set.GetKey(curr_key); |
1519 THR_Print("* %s\n", function.ToQualifiedCString()); | 1529 THR_Print("* %s\n", function.ToQualifiedCString()); |
1520 } | 1530 } |
1521 THR_Print("%" Pd " of %" Pd " dynamic selectors are unique\n", | 1531 THR_Print("%" Pd " of %" Pd " dynamic selectors are unique\n", |
1522 functions_set.NumOccupied(), table.NumOccupied()); | 1532 functions_set.NumOccupied(), table.NumOccupied()); |
1523 } | 1533 } |
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 // We do not add the token position now because we don't know the | 2822 // We do not add the token position now because we don't know the |
2813 // position of the inlined call until later. A side effect of this | 2823 // position of the inlined call until later. A side effect of this |
2814 // is that the length of |inline_id_to_function| is always larger | 2824 // is that the length of |inline_id_to_function| is always larger |
2815 // than the length of |inline_id_to_token_pos| by one. | 2825 // than the length of |inline_id_to_token_pos| by one. |
2816 // Top scope function has no caller (-1). We do this because we expect | 2826 // Top scope function has no caller (-1). We do this because we expect |
2817 // all token positions to be at an inlined call. | 2827 // all token positions to be at an inlined call. |
2818 // Top scope function has no caller (-1). | 2828 // Top scope function has no caller (-1). |
2819 caller_inline_id.Add(-1); | 2829 caller_inline_id.Add(-1); |
2820 CSTAT_TIMER_SCOPE(thread(), graphoptimizer_timer); | 2830 CSTAT_TIMER_SCOPE(thread(), graphoptimizer_timer); |
2821 | 2831 |
2822 AotOptimizer optimizer(flow_graph, | 2832 AotOptimizer optimizer(precompiler_, |
| 2833 flow_graph, |
2823 use_speculative_inlining, | 2834 use_speculative_inlining, |
2824 &inlining_black_list); | 2835 &inlining_black_list); |
2825 optimizer.PopulateWithICData(); | 2836 optimizer.PopulateWithICData(); |
2826 | 2837 |
2827 optimizer.ApplyClassIds(); | 2838 optimizer.ApplyClassIds(); |
2828 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 2839 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
2829 | 2840 |
2830 FlowGraphTypePropagator::Propagate(flow_graph); | 2841 FlowGraphTypePropagator::Propagate(flow_graph); |
2831 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 2842 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
2832 | 2843 |
(...skipping 21 matching lines...) Expand all Loading... |
2854 | 2865 |
2855 // Use propagated class-ids to create more inlining opportunities. | 2866 // Use propagated class-ids to create more inlining opportunities. |
2856 optimizer.ApplyClassIds(); | 2867 optimizer.ApplyClassIds(); |
2857 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 2868 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
2858 | 2869 |
2859 FlowGraphInliner inliner(flow_graph, | 2870 FlowGraphInliner inliner(flow_graph, |
2860 &inline_id_to_function, | 2871 &inline_id_to_function, |
2861 &inline_id_to_token_pos, | 2872 &inline_id_to_token_pos, |
2862 &caller_inline_id, | 2873 &caller_inline_id, |
2863 use_speculative_inlining, | 2874 use_speculative_inlining, |
2864 &inlining_black_list); | 2875 &inlining_black_list, |
| 2876 precompiler_); |
2865 inliner.Inline(); | 2877 inliner.Inline(); |
2866 // Use lists are maintained and validated by the inliner. | 2878 // Use lists are maintained and validated by the inliner. |
2867 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 2879 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
2868 } | 2880 } |
2869 | 2881 |
2870 // Propagate types and eliminate more type tests. | 2882 // Propagate types and eliminate more type tests. |
2871 FlowGraphTypePropagator::Propagate(flow_graph); | 2883 FlowGraphTypePropagator::Propagate(flow_graph); |
2872 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 2884 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
2873 | 2885 |
2874 { | 2886 { |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3233 } | 3245 } |
3234 is_compiled = false; | 3246 is_compiled = false; |
3235 } | 3247 } |
3236 // Reset global isolate state. | 3248 // Reset global isolate state. |
3237 thread()->set_deopt_id(prev_deopt_id); | 3249 thread()->set_deopt_id(prev_deopt_id); |
3238 } | 3250 } |
3239 return is_compiled; | 3251 return is_compiled; |
3240 } | 3252 } |
3241 | 3253 |
3242 | 3254 |
3243 static RawError* PrecompileFunctionHelper(CompilationPipeline* pipeline, | 3255 static RawError* PrecompileFunctionHelper(Precompiler* precompiler, |
| 3256 CompilationPipeline* pipeline, |
3244 const Function& function, | 3257 const Function& function, |
3245 bool optimized) { | 3258 bool optimized) { |
3246 // Check that we optimize, except if the function is not optimizable. | 3259 // Check that we optimize, except if the function is not optimizable. |
3247 ASSERT(FLAG_precompiled_mode); | 3260 ASSERT(FLAG_precompiled_mode); |
3248 ASSERT(!function.IsOptimizable() || optimized); | 3261 ASSERT(!function.IsOptimizable() || optimized); |
3249 ASSERT(!function.HasCode()); | 3262 ASSERT(!function.HasCode()); |
3250 LongJumpScope jump; | 3263 LongJumpScope jump; |
3251 if (setjmp(*jump.Set()) == 0) { | 3264 if (setjmp(*jump.Set()) == 0) { |
3252 Thread* const thread = Thread::Current(); | 3265 Thread* const thread = Thread::Current(); |
3253 StackZone stack_zone(thread); | 3266 StackZone stack_zone(thread); |
(...skipping 21 matching lines...) Expand all Loading... |
3275 { | 3288 { |
3276 HANDLESCOPE(thread); | 3289 HANDLESCOPE(thread); |
3277 const int64_t num_tokens_before = STAT_VALUE(thread, num_tokens_consumed); | 3290 const int64_t num_tokens_before = STAT_VALUE(thread, num_tokens_consumed); |
3278 pipeline->ParseFunction(parsed_function); | 3291 pipeline->ParseFunction(parsed_function); |
3279 const int64_t num_tokens_after = STAT_VALUE(thread, num_tokens_consumed); | 3292 const int64_t num_tokens_after = STAT_VALUE(thread, num_tokens_consumed); |
3280 INC_STAT(thread, | 3293 INC_STAT(thread, |
3281 num_func_tokens_compiled, | 3294 num_func_tokens_compiled, |
3282 num_tokens_after - num_tokens_before); | 3295 num_tokens_after - num_tokens_before); |
3283 } | 3296 } |
3284 | 3297 |
3285 PrecompileParsedFunctionHelper helper(parsed_function, optimized); | 3298 PrecompileParsedFunctionHelper helper( |
| 3299 precompiler, parsed_function, optimized); |
3286 const bool success = helper.Compile(pipeline); | 3300 const bool success = helper.Compile(pipeline); |
3287 if (!success) { | 3301 if (!success) { |
3288 // Encountered error. | 3302 // Encountered error. |
3289 Error& error = Error::Handle(); | 3303 Error& error = Error::Handle(); |
3290 // We got an error during compilation. | 3304 // We got an error during compilation. |
3291 error = thread->sticky_error(); | 3305 error = thread->sticky_error(); |
3292 thread->clear_sticky_error(); | 3306 thread->clear_sticky_error(); |
3293 ASSERT(error.IsLanguageError() && | 3307 ASSERT(error.IsLanguageError() && |
3294 LanguageError::Cast(error).kind() != Report::kBailout); | 3308 LanguageError::Cast(error).kind() != Report::kBailout); |
3295 return error.raw(); | 3309 return error.raw(); |
(...skipping 27 matching lines...) Expand all Loading... |
3323 // Precompilation may encounter compile-time errors. | 3337 // Precompilation may encounter compile-time errors. |
3324 // Do not attempt to optimize functions that can cause errors. | 3338 // Do not attempt to optimize functions that can cause errors. |
3325 function.set_is_optimizable(false); | 3339 function.set_is_optimizable(false); |
3326 return error.raw(); | 3340 return error.raw(); |
3327 } | 3341 } |
3328 UNREACHABLE(); | 3342 UNREACHABLE(); |
3329 return Error::null(); | 3343 return Error::null(); |
3330 } | 3344 } |
3331 | 3345 |
3332 | 3346 |
3333 RawError* Precompiler::CompileFunction(Thread* thread, | 3347 RawError* Precompiler::CompileFunction(Precompiler* precompiler, |
| 3348 Thread* thread, |
3334 Zone* zone, | 3349 Zone* zone, |
3335 const Function& function, | 3350 const Function& function) { |
3336 FieldTypeMap* field_type_map) { | |
3337 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); | 3351 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); |
3338 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, "CompileFunction", function); | 3352 TIMELINE_FUNCTION_COMPILATION_DURATION(thread, "CompileFunction", function); |
3339 | 3353 |
3340 ASSERT(FLAG_precompiled_mode); | 3354 ASSERT(FLAG_precompiled_mode); |
3341 const bool optimized = function.IsOptimizable(); // False for natives. | 3355 const bool optimized = function.IsOptimizable(); // False for natives. |
3342 DartPrecompilationPipeline pipeline(zone, field_type_map); | 3356 DartPrecompilationPipeline pipeline(zone, |
3343 return PrecompileFunctionHelper(&pipeline, function, optimized); | 3357 (precompiler != NULL) ? precompiler->field_type_map() : NULL); |
| 3358 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized); |
3344 } | 3359 } |
3345 | 3360 |
3346 #endif // DART_PRECOMPILER | 3361 #endif // DART_PRECOMPILER |
3347 | 3362 |
3348 } // namespace dart | 3363 } // namespace dart |
OLD | NEW |