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 11 matching lines...) Expand all Loading... |
22 #include "vm/flow_graph_compiler.h" | 22 #include "vm/flow_graph_compiler.h" |
23 #include "vm/flow_graph_inliner.h" | 23 #include "vm/flow_graph_inliner.h" |
24 #include "vm/flow_graph_optimizer.h" | 24 #include "vm/flow_graph_optimizer.h" |
25 #include "vm/flow_graph_type_propagator.h" | 25 #include "vm/flow_graph_type_propagator.h" |
26 #include "vm/il_printer.h" | 26 #include "vm/il_printer.h" |
27 #include "vm/longjump.h" | 27 #include "vm/longjump.h" |
28 #include "vm/object.h" | 28 #include "vm/object.h" |
29 #include "vm/object_store.h" | 29 #include "vm/object_store.h" |
30 #include "vm/os.h" | 30 #include "vm/os.h" |
31 #include "vm/parser.h" | 31 #include "vm/parser.h" |
| 32 #include "vm/regexp_parser.h" |
| 33 #include "vm/regexp_assembler.h" |
32 #include "vm/scanner.h" | 34 #include "vm/scanner.h" |
33 #include "vm/symbols.h" | 35 #include "vm/symbols.h" |
34 #include "vm/tags.h" | 36 #include "vm/tags.h" |
35 #include "vm/timer.h" | 37 #include "vm/timer.h" |
36 | 38 |
37 namespace dart { | 39 namespace dart { |
38 | 40 |
39 DEFINE_FLAG(bool, allocation_sinking, true, | 41 DEFINE_FLAG(bool, allocation_sinking, true, |
40 "Attempt to sink temporary allocations to side exits"); | 42 "Attempt to sink temporary allocations to side exits"); |
41 DEFINE_FLAG(bool, common_subexpression_elimination, true, | 43 DEFINE_FLAG(bool, common_subexpression_elimination, true, |
(...skipping 14 matching lines...) Expand all Loading... |
56 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); | 58 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); |
57 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering."); | 59 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering."); |
58 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); | 60 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); |
59 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); | 61 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); |
60 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); | 62 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); |
61 DEFINE_FLAG(bool, verify_compiler, false, | 63 DEFINE_FLAG(bool, verify_compiler, false, |
62 "Enable compiler verification assertions"); | 64 "Enable compiler verification assertions"); |
63 | 65 |
64 DECLARE_FLAG(bool, trace_failed_optimization_attempts); | 66 DECLARE_FLAG(bool, trace_failed_optimization_attempts); |
65 DECLARE_FLAG(bool, trace_patching); | 67 DECLARE_FLAG(bool, trace_patching); |
| 68 DECLARE_FLAG(bool, trace_irregexp); |
| 69 |
| 70 // TODO(jgruber): Factor out unoptimizing/optimizing pipelines and remove |
| 71 // separate helpers functions & `optimizing` args. |
| 72 class CompilationPipeline : public ZoneAllocated { |
| 73 public: |
| 74 static CompilationPipeline* New(Isolate* isolate, const Function& function); |
| 75 |
| 76 virtual void ParseFunction(ParsedFunction* parsed_function) = 0; |
| 77 virtual FlowGraph* BuildFlowGraph( |
| 78 ParsedFunction* parsed_function, |
| 79 const ZoneGrowableArray<const ICData*>& ic_data_array, |
| 80 intptr_t osr_id) = 0; |
| 81 virtual void FinalizeCompilation() = 0; |
| 82 virtual ~CompilationPipeline() { } |
| 83 }; |
| 84 |
| 85 |
| 86 class DefaultCompilationPipeline : public CompilationPipeline { |
| 87 public: |
| 88 virtual void ParseFunction(ParsedFunction* parsed_function) { |
| 89 Parser::ParseFunction(parsed_function); |
| 90 parsed_function->AllocateVariables(); |
| 91 } |
| 92 |
| 93 virtual FlowGraph* BuildFlowGraph( |
| 94 ParsedFunction* parsed_function, |
| 95 const ZoneGrowableArray<const ICData*>& ic_data_array, |
| 96 intptr_t osr_id) { |
| 97 // Build the flow graph. |
| 98 FlowGraphBuilder builder(parsed_function, |
| 99 ic_data_array, |
| 100 NULL, // NULL = not inlining. |
| 101 osr_id); |
| 102 |
| 103 return builder.BuildGraph(); |
| 104 } |
| 105 |
| 106 virtual void FinalizeCompilation() { } |
| 107 }; |
| 108 |
| 109 |
| 110 class IrregexpCompilationPipeline : public DefaultCompilationPipeline { |
| 111 public: |
| 112 explicit IrregexpCompilationPipeline(Isolate* isolate) |
| 113 : macro_assembler_(NULL), |
| 114 isolate_(isolate) { } |
| 115 |
| 116 virtual void ParseFunction(ParsedFunction* parsed_function) { |
| 117 RegExpParser::ParseFunction(parsed_function); |
| 118 // Variables are allocated after compilation. |
| 119 } |
| 120 |
| 121 virtual FlowGraph* BuildFlowGraph( |
| 122 ParsedFunction* parsed_function, |
| 123 const ZoneGrowableArray<const ICData*>& ic_data_array, |
| 124 intptr_t osr_id) { |
| 125 // Compile to the dart IR. |
| 126 RegExpEngine::CompilationResult result = |
| 127 RegExpEngine::Compile(parsed_function->regexp_compile_data(), |
| 128 parsed_function, |
| 129 ic_data_array); |
| 130 macro_assembler_ = result.macro_assembler; |
| 131 |
| 132 // Allocate variables now that we know the number of locals. |
| 133 parsed_function->AllocateIrregexpVariables(result.num_stack_locals); |
| 134 |
| 135 // Build the flow graph. |
| 136 FlowGraphBuilder builder(parsed_function, |
| 137 ic_data_array, |
| 138 NULL, // NULL = not inlining. |
| 139 osr_id); |
| 140 |
| 141 return new(isolate_) FlowGraph(builder, |
| 142 result.graph_entry, |
| 143 result.num_blocks); |
| 144 } |
| 145 |
| 146 virtual void FinalizeCompilation() { |
| 147 macro_assembler_->FinalizeBlockOffsetTable(); |
| 148 } |
| 149 |
| 150 private: |
| 151 IRRegExpMacroAssembler* macro_assembler_; |
| 152 Isolate* isolate_; |
| 153 }; |
| 154 |
| 155 CompilationPipeline* CompilationPipeline::New(Isolate* isolate, |
| 156 const Function& function) { |
| 157 if (function.IsIrregexpFunction()) { |
| 158 return new(isolate) IrregexpCompilationPipeline(isolate); |
| 159 } else { |
| 160 return new(isolate) DefaultCompilationPipeline(); |
| 161 } |
| 162 } |
| 163 |
66 | 164 |
67 // Compile a function. Should call only if the function has not been compiled. | 165 // Compile a function. Should call only if the function has not been compiled. |
68 // Arg0: function object. | 166 // Arg0: function object. |
69 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { | 167 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { |
70 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); | 168 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); |
71 ASSERT(!function.HasCode()); | 169 ASSERT(!function.HasCode()); |
72 const Error& error = Error::Handle(Compiler::CompileFunction(isolate, | 170 const Error& error = Error::Handle(Compiler::CompileFunction(isolate, |
73 function)); | 171 function)); |
74 if (!error.IsNull()) { | 172 if (!error.IsNull()) { |
75 Exceptions::PropagateError(error); | 173 Exceptions::PropagateError(error); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 error = isolate->object_store()->sticky_error(); | 355 error = isolate->object_store()->sticky_error(); |
258 isolate->object_store()->clear_sticky_error(); | 356 isolate->object_store()->clear_sticky_error(); |
259 return error.raw(); | 357 return error.raw(); |
260 } | 358 } |
261 UNREACHABLE(); | 359 UNREACHABLE(); |
262 return Error::null(); | 360 return Error::null(); |
263 } | 361 } |
264 | 362 |
265 | 363 |
266 // Return false if bailed out. | 364 // Return false if bailed out. |
267 static bool CompileParsedFunctionHelper(ParsedFunction* parsed_function, | 365 static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline, |
| 366 ParsedFunction* parsed_function, |
268 bool optimized, | 367 bool optimized, |
269 intptr_t osr_id) { | 368 intptr_t osr_id) { |
270 const Function& function = parsed_function->function(); | 369 const Function& function = parsed_function->function(); |
271 if (optimized && !function.IsOptimizable()) { | 370 if (optimized && !function.IsOptimizable()) { |
272 return false; | 371 return false; |
273 } | 372 } |
274 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); | 373 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); |
275 bool is_compiled = false; | 374 bool is_compiled = false; |
276 Isolate* isolate = Isolate::Current(); | 375 Isolate* isolate = Isolate::Current(); |
277 HANDLESCOPE(isolate); | 376 HANDLESCOPE(isolate); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 if (FLAG_print_ic_data_map) { | 413 if (FLAG_print_ic_data_map) { |
315 for (intptr_t i = 0; i < ic_data_array->length(); i++) { | 414 for (intptr_t i = 0; i < ic_data_array->length(); i++) { |
316 if ((*ic_data_array)[i] != NULL) { | 415 if ((*ic_data_array)[i] != NULL) { |
317 OS::Print("%" Pd " ", i); | 416 OS::Print("%" Pd " ", i); |
318 FlowGraphPrinter::PrintICData(*(*ic_data_array)[i]); | 417 FlowGraphPrinter::PrintICData(*(*ic_data_array)[i]); |
319 } | 418 } |
320 } | 419 } |
321 } | 420 } |
322 } | 421 } |
323 | 422 |
324 // Build the flow graph. | 423 flow_graph = pipeline->BuildFlowGraph(parsed_function, |
325 FlowGraphBuilder builder(parsed_function, | 424 *ic_data_array, |
326 *ic_data_array, | 425 osr_id); |
327 NULL, // NULL = not inlining. | |
328 osr_id); | |
329 flow_graph = builder.BuildGraph(); | |
330 } | 426 } |
331 | 427 |
332 if (FLAG_print_flow_graph || | 428 if (FLAG_print_flow_graph || |
333 (optimized && FLAG_print_flow_graph_optimized)) { | 429 (optimized && FLAG_print_flow_graph_optimized)) { |
334 if (osr_id == Isolate::kNoDeoptId) { | 430 if (osr_id == Isolate::kNoDeoptId) { |
335 FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph); | 431 FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph); |
336 } else { | 432 } else { |
337 FlowGraphPrinter::PrintGraph("For OSR", flow_graph); | 433 FlowGraphPrinter::PrintGraph("For OSR", flow_graph); |
338 } | 434 } |
339 } | 435 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 } | 672 } |
577 } | 673 } |
578 | 674 |
579 Assembler assembler(use_far_branches); | 675 Assembler assembler(use_far_branches); |
580 FlowGraphCompiler graph_compiler(&assembler, flow_graph, optimized); | 676 FlowGraphCompiler graph_compiler(&assembler, flow_graph, optimized); |
581 { | 677 { |
582 TimerScope timer(FLAG_compiler_stats, | 678 TimerScope timer(FLAG_compiler_stats, |
583 &CompilerStats::graphcompiler_timer, | 679 &CompilerStats::graphcompiler_timer, |
584 isolate); | 680 isolate); |
585 graph_compiler.CompileGraph(); | 681 graph_compiler.CompileGraph(); |
| 682 pipeline->FinalizeCompilation(); |
586 } | 683 } |
587 { | 684 { |
588 TimerScope timer(FLAG_compiler_stats, | 685 TimerScope timer(FLAG_compiler_stats, |
589 &CompilerStats::codefinalizer_timer, | 686 &CompilerStats::codefinalizer_timer, |
590 isolate); | 687 isolate); |
591 const Code& code = Code::Handle( | 688 const Code& code = Code::Handle( |
592 Code::FinalizeCode(function, &assembler, optimized)); | 689 Code::FinalizeCode(function, &assembler, optimized)); |
593 code.set_is_optimized(optimized); | 690 code.set_is_optimized(optimized); |
594 graph_compiler.FinalizePcDescriptors(code); | 691 graph_compiler.FinalizePcDescriptors(code); |
595 graph_compiler.FinalizeDeoptInfo(code); | 692 graph_compiler.FinalizeDeoptInfo(code); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 start + offset.Value(), | 907 start + offset.Value(), |
811 function.ToFullyQualifiedCString(), | 908 function.ToFullyQualifiedCString(), |
812 code.raw()); | 909 code.raw()); |
813 } | 910 } |
814 } | 911 } |
815 OS::Print("}\n"); | 912 OS::Print("}\n"); |
816 } | 913 } |
817 } | 914 } |
818 | 915 |
819 | 916 |
820 static RawError* CompileFunctionHelper(const Function& function, | 917 static RawError* CompileFunctionHelper(CompilationPipeline* pipeline, |
| 918 const Function& function, |
821 bool optimized, | 919 bool optimized, |
822 intptr_t osr_id) { | 920 intptr_t osr_id) { |
823 Isolate* isolate = Isolate::Current(); | 921 Isolate* isolate = Isolate::Current(); |
824 StackZone zone(isolate); | 922 StackZone zone(isolate); |
825 LongJumpScope jump; | 923 LongJumpScope jump; |
826 if (setjmp(*jump.Set()) == 0) { | 924 if (setjmp(*jump.Set()) == 0) { |
827 TIMERSCOPE(isolate, time_compilation); | 925 TIMERSCOPE(isolate, time_compilation); |
828 Timer per_compile_timer(FLAG_trace_compiler, "Compilation time"); | 926 Timer per_compile_timer(FLAG_trace_compiler, "Compilation time"); |
829 per_compile_timer.Start(); | 927 per_compile_timer.Start(); |
830 ParsedFunction* parsed_function = new(isolate) ParsedFunction( | 928 ParsedFunction* parsed_function = new(isolate) ParsedFunction( |
831 isolate, Function::ZoneHandle(isolate, function.raw())); | 929 isolate, Function::ZoneHandle(isolate, function.raw())); |
832 if (FLAG_trace_compiler) { | 930 if (FLAG_trace_compiler) { |
833 OS::Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n", | 931 OS::Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n", |
834 (osr_id == Isolate::kNoDeoptId ? "" : "osr "), | 932 (osr_id == Isolate::kNoDeoptId ? "" : "osr "), |
835 (optimized ? "optimized " : ""), | 933 (optimized ? "optimized " : ""), |
836 function.ToFullyQualifiedCString(), | 934 function.ToFullyQualifiedCString(), |
837 function.token_pos(), | 935 function.token_pos(), |
838 (function.end_token_pos() - function.token_pos())); | 936 (function.end_token_pos() - function.token_pos())); |
839 } | 937 } |
840 { | 938 { |
841 HANDLESCOPE(isolate); | 939 HANDLESCOPE(isolate); |
842 Parser::ParseFunction(parsed_function); | 940 pipeline->ParseFunction(parsed_function); |
843 parsed_function->AllocateVariables(); | |
844 } | 941 } |
845 | 942 |
846 const bool success = | 943 const bool success = CompileParsedFunctionHelper(pipeline, |
847 CompileParsedFunctionHelper(parsed_function, optimized, osr_id); | 944 parsed_function, |
| 945 optimized, |
| 946 osr_id); |
848 if (!success) { | 947 if (!success) { |
849 if (optimized) { | 948 if (optimized) { |
850 // Optimizer bailed out. Disable optimizations and to never try again. | 949 // Optimizer bailed out. Disable optimizations and to never try again. |
851 if (FLAG_trace_compiler) { | 950 if (FLAG_trace_compiler) { |
852 OS::Print("--> disabling optimizations for '%s'\n", | 951 OS::Print("--> disabling optimizations for '%s'\n", |
853 function.ToFullyQualifiedCString()); | 952 function.ToFullyQualifiedCString()); |
854 } else if (FLAG_trace_failed_optimization_attempts) { | 953 } else if (FLAG_trace_failed_optimization_attempts) { |
855 OS::Print("Cannot optimize: %s\n", | 954 OS::Print("Cannot optimize: %s\n", |
856 function.ToFullyQualifiedCString()); | 955 function.ToFullyQualifiedCString()); |
857 } | 956 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 return error.raw(); | 990 return error.raw(); |
892 } | 991 } |
893 UNREACHABLE(); | 992 UNREACHABLE(); |
894 return Error::null(); | 993 return Error::null(); |
895 } | 994 } |
896 | 995 |
897 | 996 |
898 RawError* Compiler::CompileFunction(Isolate* isolate, | 997 RawError* Compiler::CompileFunction(Isolate* isolate, |
899 const Function& function) { | 998 const Function& function) { |
900 VMTagScope tagScope(isolate, VMTag::kCompileUnoptimizedTagId); | 999 VMTagScope tagScope(isolate, VMTag::kCompileUnoptimizedTagId); |
901 return CompileFunctionHelper(function, false, Isolate::kNoDeoptId); | 1000 CompilationPipeline* pipeline = CompilationPipeline::New(isolate, function); |
| 1001 return CompileFunctionHelper(pipeline, function, false, Isolate::kNoDeoptId); |
902 } | 1002 } |
903 | 1003 |
904 | 1004 |
905 RawError* Compiler::CompileOptimizedFunction(Isolate* isolate, | 1005 RawError* Compiler::CompileOptimizedFunction(Isolate* isolate, |
906 const Function& function, | 1006 const Function& function, |
907 intptr_t osr_id) { | 1007 intptr_t osr_id) { |
908 VMTagScope tagScope(isolate, VMTag::kCompileOptimizedTagId); | 1008 VMTagScope tagScope(isolate, VMTag::kCompileOptimizedTagId); |
909 return CompileFunctionHelper(function, true, osr_id); | 1009 CompilationPipeline* pipeline = CompilationPipeline::New(isolate, function); |
| 1010 return CompileFunctionHelper(pipeline, function, true, osr_id); |
910 } | 1011 } |
911 | 1012 |
912 | 1013 |
913 // This is only used from unit tests. | 1014 // This is only used from unit tests. |
914 RawError* Compiler::CompileParsedFunction( | 1015 RawError* Compiler::CompileParsedFunction( |
915 ParsedFunction* parsed_function) { | 1016 ParsedFunction* parsed_function) { |
916 Isolate* isolate = Isolate::Current(); | 1017 Isolate* isolate = Isolate::Current(); |
917 LongJumpScope jump; | 1018 LongJumpScope jump; |
918 if (setjmp(*jump.Set()) == 0) { | 1019 if (setjmp(*jump.Set()) == 0) { |
919 // Non-optimized code generator. | 1020 // Non-optimized code generator. |
920 CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId); | 1021 DefaultCompilationPipeline pipeline; |
| 1022 CompileParsedFunctionHelper(&pipeline, |
| 1023 parsed_function, |
| 1024 false, |
| 1025 Isolate::kNoDeoptId); |
921 if (FLAG_disassemble) { | 1026 if (FLAG_disassemble) { |
922 DisassembleCode(parsed_function->function(), false); | 1027 DisassembleCode(parsed_function->function(), false); |
923 } | 1028 } |
924 return Error::null(); | 1029 return Error::null(); |
925 } else { | 1030 } else { |
926 Error& error = Error::Handle(); | 1031 Error& error = Error::Handle(); |
927 // We got an error during compilation. | 1032 // We got an error during compilation. |
928 error = isolate->object_store()->sticky_error(); | 1033 error = isolate->object_store()->sticky_error(); |
929 isolate->object_store()->clear_sticky_error(); | 1034 isolate->object_store()->clear_sticky_error(); |
930 return error.raw(); | 1035 return error.raw(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 ASSERT(field.value() == Object::transition_sentinel().raw()); | 1092 ASSERT(field.value() == Object::transition_sentinel().raw()); |
988 Isolate* isolate = Isolate::Current(); | 1093 Isolate* isolate = Isolate::Current(); |
989 StackZone zone(isolate); | 1094 StackZone zone(isolate); |
990 LongJumpScope jump; | 1095 LongJumpScope jump; |
991 if (setjmp(*jump.Set()) == 0) { | 1096 if (setjmp(*jump.Set()) == 0) { |
992 ParsedFunction* parsed_function = | 1097 ParsedFunction* parsed_function = |
993 Parser::ParseStaticFieldInitializer(field); | 1098 Parser::ParseStaticFieldInitializer(field); |
994 | 1099 |
995 parsed_function->AllocateVariables(); | 1100 parsed_function->AllocateVariables(); |
996 // Non-optimized code generator. | 1101 // Non-optimized code generator. |
997 CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId); | 1102 DefaultCompilationPipeline pipeline; |
| 1103 CompileParsedFunctionHelper(&pipeline, |
| 1104 parsed_function, |
| 1105 false, |
| 1106 Isolate::kNoDeoptId); |
998 | 1107 |
999 // Invoke the function to evaluate the expression. | 1108 // Invoke the function to evaluate the expression. |
1000 const Function& initializer = parsed_function->function(); | 1109 const Function& initializer = parsed_function->function(); |
1001 const Object& result = PassiveObject::Handle( | 1110 const Object& result = PassiveObject::Handle( |
1002 DartEntry::InvokeFunction(initializer, Object::empty_array())); | 1111 DartEntry::InvokeFunction(initializer, Object::empty_array())); |
1003 return result.raw(); | 1112 return result.raw(); |
1004 } else { | 1113 } else { |
1005 const Error& error = | 1114 const Error& error = |
1006 Error::Handle(isolate, isolate->object_store()->sticky_error()); | 1115 Error::Handle(isolate, isolate->object_store()->sticky_error()); |
1007 isolate->object_store()->clear_sticky_error(); | 1116 isolate->object_store()->clear_sticky_error(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 // would compile func automatically. We are checking fewer invariants | 1156 // would compile func automatically. We are checking fewer invariants |
1048 // here. | 1157 // here. |
1049 ParsedFunction* parsed_function = new ParsedFunction(isolate, func); | 1158 ParsedFunction* parsed_function = new ParsedFunction(isolate, func); |
1050 parsed_function->SetNodeSequence(fragment); | 1159 parsed_function->SetNodeSequence(fragment); |
1051 parsed_function->set_default_parameter_values(Object::null_array()); | 1160 parsed_function->set_default_parameter_values(Object::null_array()); |
1052 parsed_function->EnsureExpressionTemp(); | 1161 parsed_function->EnsureExpressionTemp(); |
1053 fragment->scope()->AddVariable(parsed_function->expression_temp_var()); | 1162 fragment->scope()->AddVariable(parsed_function->expression_temp_var()); |
1054 parsed_function->AllocateVariables(); | 1163 parsed_function->AllocateVariables(); |
1055 | 1164 |
1056 // Non-optimized code generator. | 1165 // Non-optimized code generator. |
1057 CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId); | 1166 DefaultCompilationPipeline pipeline; |
| 1167 CompileParsedFunctionHelper(&pipeline, |
| 1168 parsed_function, |
| 1169 false, |
| 1170 Isolate::kNoDeoptId); |
1058 | 1171 |
1059 const Object& result = PassiveObject::Handle( | 1172 const Object& result = PassiveObject::Handle( |
1060 DartEntry::InvokeFunction(func, Object::empty_array())); | 1173 DartEntry::InvokeFunction(func, Object::empty_array())); |
1061 return result.raw(); | 1174 return result.raw(); |
1062 } else { | 1175 } else { |
1063 const Object& result = | 1176 const Object& result = |
1064 PassiveObject::Handle(isolate->object_store()->sticky_error()); | 1177 PassiveObject::Handle(isolate->object_store()->sticky_error()); |
1065 isolate->object_store()->clear_sticky_error(); | 1178 isolate->object_store()->clear_sticky_error(); |
1066 return result.raw(); | 1179 return result.raw(); |
1067 } | 1180 } |
1068 UNREACHABLE(); | 1181 UNREACHABLE(); |
1069 return Object::null(); | 1182 return Object::null(); |
1070 } | 1183 } |
1071 | 1184 |
1072 } // namespace dart | 1185 } // namespace dart |
OLD | NEW |