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(zerny): 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 DartCompilationPipeline : 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 CompilationPipeline { |
| 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) DartCompilationPipeline(); |
| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 start + offset.Value(), | 905 start + offset.Value(), |
809 function.ToFullyQualifiedCString(), | 906 function.ToFullyQualifiedCString(), |
810 code.raw()); | 907 code.raw()); |
811 } | 908 } |
812 } | 909 } |
813 OS::Print("}\n"); | 910 OS::Print("}\n"); |
814 } | 911 } |
815 } | 912 } |
816 | 913 |
817 | 914 |
818 static RawError* CompileFunctionHelper(const Function& function, | 915 static RawError* CompileFunctionHelper(CompilationPipeline* pipeline, |
| 916 const Function& function, |
819 bool optimized, | 917 bool optimized, |
820 intptr_t osr_id) { | 918 intptr_t osr_id) { |
821 Isolate* isolate = Isolate::Current(); | 919 Isolate* isolate = Isolate::Current(); |
822 StackZone zone(isolate); | 920 StackZone zone(isolate); |
823 LongJumpScope jump; | 921 LongJumpScope jump; |
824 if (setjmp(*jump.Set()) == 0) { | 922 if (setjmp(*jump.Set()) == 0) { |
825 TIMERSCOPE(isolate, time_compilation); | 923 TIMERSCOPE(isolate, time_compilation); |
826 Timer per_compile_timer(FLAG_trace_compiler, "Compilation time"); | 924 Timer per_compile_timer(FLAG_trace_compiler, "Compilation time"); |
827 per_compile_timer.Start(); | 925 per_compile_timer.Start(); |
828 ParsedFunction* parsed_function = new(isolate) ParsedFunction( | 926 ParsedFunction* parsed_function = new(isolate) ParsedFunction( |
829 isolate, Function::ZoneHandle(isolate, function.raw())); | 927 isolate, Function::ZoneHandle(isolate, function.raw())); |
830 if (FLAG_trace_compiler) { | 928 if (FLAG_trace_compiler) { |
831 OS::Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n", | 929 OS::Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n", |
832 (osr_id == Isolate::kNoDeoptId ? "" : "osr "), | 930 (osr_id == Isolate::kNoDeoptId ? "" : "osr "), |
833 (optimized ? "optimized " : ""), | 931 (optimized ? "optimized " : ""), |
834 function.ToFullyQualifiedCString(), | 932 function.ToFullyQualifiedCString(), |
835 function.token_pos(), | 933 function.token_pos(), |
836 (function.end_token_pos() - function.token_pos())); | 934 (function.end_token_pos() - function.token_pos())); |
837 } | 935 } |
838 { | 936 { |
839 HANDLESCOPE(isolate); | 937 HANDLESCOPE(isolate); |
840 Parser::ParseFunction(parsed_function); | 938 pipeline->ParseFunction(parsed_function); |
841 parsed_function->AllocateVariables(); | |
842 } | 939 } |
843 | 940 |
844 const bool success = | 941 const bool success = CompileParsedFunctionHelper(pipeline, |
845 CompileParsedFunctionHelper(parsed_function, optimized, osr_id); | 942 parsed_function, |
| 943 optimized, |
| 944 osr_id); |
846 if (!success) { | 945 if (!success) { |
847 if (optimized) { | 946 if (optimized) { |
848 // Optimizer bailed out. Disable optimizations and to never try again. | 947 // Optimizer bailed out. Disable optimizations and to never try again. |
849 if (FLAG_trace_compiler) { | 948 if (FLAG_trace_compiler) { |
850 OS::Print("--> disabling optimizations for '%s'\n", | 949 OS::Print("--> disabling optimizations for '%s'\n", |
851 function.ToFullyQualifiedCString()); | 950 function.ToFullyQualifiedCString()); |
852 } else if (FLAG_trace_failed_optimization_attempts) { | 951 } else if (FLAG_trace_failed_optimization_attempts) { |
853 OS::Print("Cannot optimize: %s\n", | 952 OS::Print("Cannot optimize: %s\n", |
854 function.ToFullyQualifiedCString()); | 953 function.ToFullyQualifiedCString()); |
855 } | 954 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 return error.raw(); | 988 return error.raw(); |
890 } | 989 } |
891 UNREACHABLE(); | 990 UNREACHABLE(); |
892 return Error::null(); | 991 return Error::null(); |
893 } | 992 } |
894 | 993 |
895 | 994 |
896 RawError* Compiler::CompileFunction(Isolate* isolate, | 995 RawError* Compiler::CompileFunction(Isolate* isolate, |
897 const Function& function) { | 996 const Function& function) { |
898 VMTagScope tagScope(isolate, VMTag::kCompileUnoptimizedTagId); | 997 VMTagScope tagScope(isolate, VMTag::kCompileUnoptimizedTagId); |
899 return CompileFunctionHelper(function, false, Isolate::kNoDeoptId); | 998 CompilationPipeline* pipeline = CompilationPipeline::New(isolate, function); |
| 999 return CompileFunctionHelper(pipeline, function, false, Isolate::kNoDeoptId); |
900 } | 1000 } |
901 | 1001 |
902 | 1002 |
903 RawError* Compiler::CompileOptimizedFunction(Isolate* isolate, | 1003 RawError* Compiler::CompileOptimizedFunction(Isolate* isolate, |
904 const Function& function, | 1004 const Function& function, |
905 intptr_t osr_id) { | 1005 intptr_t osr_id) { |
906 VMTagScope tagScope(isolate, VMTag::kCompileOptimizedTagId); | 1006 VMTagScope tagScope(isolate, VMTag::kCompileOptimizedTagId); |
907 return CompileFunctionHelper(function, true, osr_id); | 1007 CompilationPipeline* pipeline = CompilationPipeline::New(isolate, function); |
| 1008 return CompileFunctionHelper(pipeline, function, true, osr_id); |
908 } | 1009 } |
909 | 1010 |
910 | 1011 |
911 // This is only used from unit tests. | 1012 // This is only used from unit tests. |
912 RawError* Compiler::CompileParsedFunction( | 1013 RawError* Compiler::CompileParsedFunction( |
913 ParsedFunction* parsed_function) { | 1014 ParsedFunction* parsed_function) { |
914 Isolate* isolate = Isolate::Current(); | 1015 Isolate* isolate = Isolate::Current(); |
915 LongJumpScope jump; | 1016 LongJumpScope jump; |
916 if (setjmp(*jump.Set()) == 0) { | 1017 if (setjmp(*jump.Set()) == 0) { |
917 // Non-optimized code generator. | 1018 // Non-optimized code generator. |
918 CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId); | 1019 DartCompilationPipeline pipeline; |
| 1020 CompileParsedFunctionHelper(&pipeline, |
| 1021 parsed_function, |
| 1022 false, |
| 1023 Isolate::kNoDeoptId); |
919 if (FLAG_disassemble) { | 1024 if (FLAG_disassemble) { |
920 DisassembleCode(parsed_function->function(), false); | 1025 DisassembleCode(parsed_function->function(), false); |
921 } | 1026 } |
922 return Error::null(); | 1027 return Error::null(); |
923 } else { | 1028 } else { |
924 Error& error = Error::Handle(); | 1029 Error& error = Error::Handle(); |
925 // We got an error during compilation. | 1030 // We got an error during compilation. |
926 error = isolate->object_store()->sticky_error(); | 1031 error = isolate->object_store()->sticky_error(); |
927 isolate->object_store()->clear_sticky_error(); | 1032 isolate->object_store()->clear_sticky_error(); |
928 return error.raw(); | 1033 return error.raw(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 ASSERT(field.value() == Object::transition_sentinel().raw()); | 1090 ASSERT(field.value() == Object::transition_sentinel().raw()); |
986 Isolate* isolate = Isolate::Current(); | 1091 Isolate* isolate = Isolate::Current(); |
987 StackZone zone(isolate); | 1092 StackZone zone(isolate); |
988 LongJumpScope jump; | 1093 LongJumpScope jump; |
989 if (setjmp(*jump.Set()) == 0) { | 1094 if (setjmp(*jump.Set()) == 0) { |
990 ParsedFunction* parsed_function = | 1095 ParsedFunction* parsed_function = |
991 Parser::ParseStaticFieldInitializer(field); | 1096 Parser::ParseStaticFieldInitializer(field); |
992 | 1097 |
993 parsed_function->AllocateVariables(); | 1098 parsed_function->AllocateVariables(); |
994 // Non-optimized code generator. | 1099 // Non-optimized code generator. |
995 CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId); | 1100 DartCompilationPipeline pipeline; |
| 1101 CompileParsedFunctionHelper(&pipeline, |
| 1102 parsed_function, |
| 1103 false, |
| 1104 Isolate::kNoDeoptId); |
996 | 1105 |
997 // Invoke the function to evaluate the expression. | 1106 // Invoke the function to evaluate the expression. |
998 const Function& initializer = parsed_function->function(); | 1107 const Function& initializer = parsed_function->function(); |
999 const Object& result = PassiveObject::Handle( | 1108 const Object& result = PassiveObject::Handle( |
1000 DartEntry::InvokeFunction(initializer, Object::empty_array())); | 1109 DartEntry::InvokeFunction(initializer, Object::empty_array())); |
1001 return result.raw(); | 1110 return result.raw(); |
1002 } else { | 1111 } else { |
1003 const Error& error = | 1112 const Error& error = |
1004 Error::Handle(isolate, isolate->object_store()->sticky_error()); | 1113 Error::Handle(isolate, isolate->object_store()->sticky_error()); |
1005 isolate->object_store()->clear_sticky_error(); | 1114 isolate->object_store()->clear_sticky_error(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 // here. | 1155 // here. |
1047 ParsedFunction* parsed_function = new ParsedFunction(isolate, func); | 1156 ParsedFunction* parsed_function = new ParsedFunction(isolate, func); |
1048 parsed_function->SetNodeSequence(fragment); | 1157 parsed_function->SetNodeSequence(fragment); |
1049 parsed_function->set_default_parameter_values(Object::null_array()); | 1158 parsed_function->set_default_parameter_values(Object::null_array()); |
1050 fragment->scope()->AddVariable(parsed_function->EnsureExpressionTemp()); | 1159 fragment->scope()->AddVariable(parsed_function->EnsureExpressionTemp()); |
1051 fragment->scope()->AddVariable( | 1160 fragment->scope()->AddVariable( |
1052 parsed_function->current_context_var()); | 1161 parsed_function->current_context_var()); |
1053 parsed_function->AllocateVariables(); | 1162 parsed_function->AllocateVariables(); |
1054 | 1163 |
1055 // Non-optimized code generator. | 1164 // Non-optimized code generator. |
1056 CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId); | 1165 DartCompilationPipeline pipeline; |
| 1166 CompileParsedFunctionHelper(&pipeline, |
| 1167 parsed_function, |
| 1168 false, |
| 1169 Isolate::kNoDeoptId); |
1057 | 1170 |
1058 const Object& result = PassiveObject::Handle( | 1171 const Object& result = PassiveObject::Handle( |
1059 DartEntry::InvokeFunction(func, Object::empty_array())); | 1172 DartEntry::InvokeFunction(func, Object::empty_array())); |
1060 return result.raw(); | 1173 return result.raw(); |
1061 } else { | 1174 } else { |
1062 const Object& result = | 1175 const Object& result = |
1063 PassiveObject::Handle(isolate->object_store()->sticky_error()); | 1176 PassiveObject::Handle(isolate->object_store()->sticky_error()); |
1064 isolate->object_store()->clear_sticky_error(); | 1177 isolate->object_store()->clear_sticky_error(); |
1065 return result.raw(); | 1178 return result.raw(); |
1066 } | 1179 } |
1067 UNREACHABLE(); | 1180 UNREACHABLE(); |
1068 return Object::null(); | 1181 return Object::null(); |
1069 } | 1182 } |
1070 | 1183 |
1071 } // namespace dart | 1184 } // namespace dart |
OLD | NEW |