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 ValueObject { | |
73 public: | |
74 virtual void ParseFunction(ParsedFunction* parsed_function) = 0; | |
75 virtual FlowGraph* BuildFlowGraph( | |
76 ParsedFunction* parsed_function, | |
77 ZoneGrowableArray<const ICData*>* ic_data_array, | |
78 intptr_t osr_id) = 0; | |
79 virtual void CompileGraph(FlowGraphCompiler* graph_compiler) = 0; | |
80 virtual ~CompilationPipeline() { } | |
81 }; | |
82 | |
83 | |
84 class StandardCompilationPipeline : public CompilationPipeline { | |
Vyacheslav Egorov (Google)
2014/10/07 15:48:30
I would call it 'Default' or 'Dart' CompilationPip
jgruber1
2014/10/07 17:16:51
Done.
| |
85 public: | |
86 virtual void ParseFunction(ParsedFunction* parsed_function) { | |
87 Parser::ParseFunction(parsed_function); | |
88 parsed_function->AllocateVariables(); | |
89 } | |
90 | |
91 virtual FlowGraph* BuildFlowGraph( | |
92 ParsedFunction* parsed_function, | |
93 ZoneGrowableArray<const ICData*>* ic_data_array, | |
94 intptr_t osr_id) { | |
95 // Build the flow graph. | |
96 FlowGraphBuilder builder(parsed_function, | |
97 *ic_data_array, | |
98 NULL, // NULL = not inlining. | |
99 osr_id); | |
100 | |
101 return builder.BuildGraph(); | |
102 } | |
103 | |
104 virtual void CompileGraph(FlowGraphCompiler* graph_compiler) { | |
Vyacheslav Egorov (Google)
2014/10/07 15:48:30
Given that CompileGraph is the same in both pipeli
jgruber1
2014/10/07 17:16:51
Done.
| |
105 graph_compiler->CompileGraph(); | |
106 } | |
107 }; | |
108 | |
109 | |
110 class IrregexpCompilationPipeline : public StandardCompilationPipeline { | |
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 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 CompileGraph(FlowGraphCompiler* graph_compiler) { | |
147 graph_compiler->CompileGraph(); | |
148 macro_assembler_->FinalizeBlockOffsetTable(); | |
149 } | |
150 | |
151 private: | |
152 IRRegExpMacroAssembler* macro_assembler_; | |
153 Isolate* isolate_; | |
154 }; | |
155 | |
66 | 156 |
67 // Compile a function. Should call only if the function has not been compiled. | 157 // Compile a function. Should call only if the function has not been compiled. |
68 // Arg0: function object. | 158 // Arg0: function object. |
69 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { | 159 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { |
70 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); | 160 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); |
71 ASSERT(!function.HasCode()); | 161 ASSERT(!function.HasCode()); |
72 const Error& error = Error::Handle(Compiler::CompileFunction(isolate, | 162 const Error& error = Error::Handle(Compiler::CompileFunction(isolate, |
73 function)); | 163 function)); |
74 if (!error.IsNull()) { | 164 if (!error.IsNull()) { |
75 Exceptions::PropagateError(error); | 165 Exceptions::PropagateError(error); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 error = isolate->object_store()->sticky_error(); | 347 error = isolate->object_store()->sticky_error(); |
258 isolate->object_store()->clear_sticky_error(); | 348 isolate->object_store()->clear_sticky_error(); |
259 return error.raw(); | 349 return error.raw(); |
260 } | 350 } |
261 UNREACHABLE(); | 351 UNREACHABLE(); |
262 return Error::null(); | 352 return Error::null(); |
263 } | 353 } |
264 | 354 |
265 | 355 |
266 // Return false if bailed out. | 356 // Return false if bailed out. |
267 static bool CompileParsedFunctionHelper(ParsedFunction* parsed_function, | 357 static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline, |
358 ParsedFunction* parsed_function, | |
268 bool optimized, | 359 bool optimized, |
269 intptr_t osr_id) { | 360 intptr_t osr_id) { |
270 const Function& function = parsed_function->function(); | 361 const Function& function = parsed_function->function(); |
271 if (optimized && !function.IsOptimizable()) { | 362 if (optimized && !function.IsOptimizable()) { |
272 return false; | 363 return false; |
273 } | 364 } |
274 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); | 365 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); |
275 bool is_compiled = false; | 366 bool is_compiled = false; |
276 Isolate* isolate = Isolate::Current(); | 367 Isolate* isolate = Isolate::Current(); |
277 HANDLESCOPE(isolate); | 368 HANDLESCOPE(isolate); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 if (FLAG_print_ic_data_map) { | 405 if (FLAG_print_ic_data_map) { |
315 for (intptr_t i = 0; i < ic_data_array->length(); i++) { | 406 for (intptr_t i = 0; i < ic_data_array->length(); i++) { |
316 if ((*ic_data_array)[i] != NULL) { | 407 if ((*ic_data_array)[i] != NULL) { |
317 OS::Print("%" Pd " ", i); | 408 OS::Print("%" Pd " ", i); |
318 FlowGraphPrinter::PrintICData(*(*ic_data_array)[i]); | 409 FlowGraphPrinter::PrintICData(*(*ic_data_array)[i]); |
319 } | 410 } |
320 } | 411 } |
321 } | 412 } |
322 } | 413 } |
323 | 414 |
324 // Build the flow graph. | 415 flow_graph = pipeline->BuildFlowGraph(parsed_function, |
325 FlowGraphBuilder builder(parsed_function, | 416 ic_data_array, |
326 *ic_data_array, | 417 osr_id); |
327 NULL, // NULL = not inlining. | |
328 osr_id); | |
329 flow_graph = builder.BuildGraph(); | |
330 } | 418 } |
331 | 419 |
332 if (FLAG_print_flow_graph || | 420 if (FLAG_print_flow_graph || |
333 (optimized && FLAG_print_flow_graph_optimized)) { | 421 (optimized && FLAG_print_flow_graph_optimized)) { |
334 if (osr_id == Isolate::kNoDeoptId) { | 422 if (osr_id == Isolate::kNoDeoptId) { |
335 FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph); | 423 FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph); |
336 } else { | 424 } else { |
337 FlowGraphPrinter::PrintGraph("For OSR", flow_graph); | 425 FlowGraphPrinter::PrintGraph("For OSR", flow_graph); |
338 } | 426 } |
339 } | 427 } |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
575 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph); | 663 FlowGraphPrinter::PrintGraph("After Optimizations", flow_graph); |
576 } | 664 } |
577 } | 665 } |
578 | 666 |
579 Assembler assembler(use_far_branches); | 667 Assembler assembler(use_far_branches); |
580 FlowGraphCompiler graph_compiler(&assembler, flow_graph, optimized); | 668 FlowGraphCompiler graph_compiler(&assembler, flow_graph, optimized); |
581 { | 669 { |
582 TimerScope timer(FLAG_compiler_stats, | 670 TimerScope timer(FLAG_compiler_stats, |
583 &CompilerStats::graphcompiler_timer, | 671 &CompilerStats::graphcompiler_timer, |
584 isolate); | 672 isolate); |
585 graph_compiler.CompileGraph(); | 673 pipeline->CompileGraph(&graph_compiler); |
586 } | 674 } |
587 { | 675 { |
588 TimerScope timer(FLAG_compiler_stats, | 676 TimerScope timer(FLAG_compiler_stats, |
589 &CompilerStats::codefinalizer_timer, | 677 &CompilerStats::codefinalizer_timer, |
590 isolate); | 678 isolate); |
591 const Code& code = Code::Handle( | 679 const Code& code = Code::Handle( |
592 Code::FinalizeCode(function, &assembler, optimized)); | 680 Code::FinalizeCode(function, &assembler, optimized)); |
593 code.set_is_optimized(optimized); | 681 code.set_is_optimized(optimized); |
594 graph_compiler.FinalizePcDescriptors(code); | 682 graph_compiler.FinalizePcDescriptors(code); |
595 graph_compiler.FinalizeDeoptInfo(code); | 683 graph_compiler.FinalizeDeoptInfo(code); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
809 start + offset.Value(), | 897 start + offset.Value(), |
810 function.ToFullyQualifiedCString(), | 898 function.ToFullyQualifiedCString(), |
811 code.raw()); | 899 code.raw()); |
812 } | 900 } |
813 } | 901 } |
814 OS::Print("}\n"); | 902 OS::Print("}\n"); |
815 } | 903 } |
816 } | 904 } |
817 | 905 |
818 | 906 |
819 static RawError* CompileFunctionHelper(const Function& function, | 907 static RawError* CompileFunctionHelper(CompilationPipeline* pipeline, |
908 const Function& function, | |
820 bool optimized, | 909 bool optimized, |
821 intptr_t osr_id) { | 910 intptr_t osr_id) { |
822 Isolate* isolate = Isolate::Current(); | 911 Isolate* isolate = Isolate::Current(); |
823 StackZone zone(isolate); | 912 StackZone zone(isolate); |
824 LongJumpScope jump; | 913 LongJumpScope jump; |
825 if (setjmp(*jump.Set()) == 0) { | 914 if (setjmp(*jump.Set()) == 0) { |
826 TIMERSCOPE(isolate, time_compilation); | 915 TIMERSCOPE(isolate, time_compilation); |
827 Timer per_compile_timer(FLAG_trace_compiler, "Compilation time"); | 916 Timer per_compile_timer(FLAG_trace_compiler, "Compilation time"); |
828 per_compile_timer.Start(); | 917 per_compile_timer.Start(); |
829 ParsedFunction* parsed_function = new(isolate) ParsedFunction( | 918 ParsedFunction* parsed_function = new(isolate) ParsedFunction( |
830 isolate, Function::ZoneHandle(isolate, function.raw())); | 919 isolate, Function::ZoneHandle(isolate, function.raw())); |
831 if (FLAG_trace_compiler) { | 920 if (FLAG_trace_compiler) { |
832 OS::Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n", | 921 OS::Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n", |
833 (osr_id == Isolate::kNoDeoptId ? "" : "osr "), | 922 (osr_id == Isolate::kNoDeoptId ? "" : "osr "), |
834 (optimized ? "optimized " : ""), | 923 (optimized ? "optimized " : ""), |
835 function.ToFullyQualifiedCString(), | 924 function.ToFullyQualifiedCString(), |
836 function.token_pos(), | 925 function.token_pos(), |
837 (function.end_token_pos() - function.token_pos())); | 926 (function.end_token_pos() - function.token_pos())); |
838 } | 927 } |
839 { | 928 { |
840 HANDLESCOPE(isolate); | 929 HANDLESCOPE(isolate); |
841 Parser::ParseFunction(parsed_function); | 930 pipeline->ParseFunction(parsed_function); |
842 parsed_function->AllocateVariables(); | |
843 } | 931 } |
844 | 932 |
845 const bool success = | 933 const bool success = CompileParsedFunctionHelper(pipeline, |
846 CompileParsedFunctionHelper(parsed_function, optimized, osr_id); | 934 parsed_function, |
935 optimized, | |
936 osr_id); | |
847 if (!success) { | 937 if (!success) { |
848 if (optimized) { | 938 if (optimized) { |
849 // Optimizer bailed out. Disable optimizations and to never try again. | 939 // Optimizer bailed out. Disable optimizations and to never try again. |
850 if (FLAG_trace_compiler) { | 940 if (FLAG_trace_compiler) { |
851 OS::Print("--> disabling optimizations for '%s'\n", | 941 OS::Print("--> disabling optimizations for '%s'\n", |
852 function.ToFullyQualifiedCString()); | 942 function.ToFullyQualifiedCString()); |
853 } else if (FLAG_trace_failed_optimization_attempts) { | 943 } else if (FLAG_trace_failed_optimization_attempts) { |
854 OS::Print("Cannot optimize: %s\n", | 944 OS::Print("Cannot optimize: %s\n", |
855 function.ToFullyQualifiedCString()); | 945 function.ToFullyQualifiedCString()); |
856 } | 946 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
890 return error.raw(); | 980 return error.raw(); |
891 } | 981 } |
892 UNREACHABLE(); | 982 UNREACHABLE(); |
893 return Error::null(); | 983 return Error::null(); |
894 } | 984 } |
895 | 985 |
896 | 986 |
897 RawError* Compiler::CompileFunction(Isolate* isolate, | 987 RawError* Compiler::CompileFunction(Isolate* isolate, |
898 const Function& function) { | 988 const Function& function) { |
899 VMTagScope tagScope(isolate, VMTag::kCompileUnoptimizedTagId); | 989 VMTagScope tagScope(isolate, VMTag::kCompileUnoptimizedTagId); |
900 return CompileFunctionHelper(function, false, Isolate::kNoDeoptId); | 990 if (function.IsIrregexpFunction()) { |
991 IrregexpCompilationPipeline pipeline(isolate); | |
992 return CompileFunctionHelper( | |
993 &pipeline, function, false, Isolate::kNoDeoptId); | |
994 } else { | |
995 StandardCompilationPipeline pipeline; | |
996 return CompileFunctionHelper( | |
997 &pipeline, function, false, Isolate::kNoDeoptId); | |
998 } | |
901 } | 999 } |
902 | 1000 |
903 | 1001 |
904 RawError* Compiler::CompileOptimizedFunction(Isolate* isolate, | 1002 RawError* Compiler::CompileOptimizedFunction(Isolate* isolate, |
905 const Function& function, | 1003 const Function& function, |
906 intptr_t osr_id) { | 1004 intptr_t osr_id) { |
907 VMTagScope tagScope(isolate, VMTag::kCompileOptimizedTagId); | 1005 VMTagScope tagScope(isolate, VMTag::kCompileOptimizedTagId); |
908 return CompileFunctionHelper(function, true, osr_id); | 1006 if (function.IsIrregexpFunction()) { |
1007 IrregexpCompilationPipeline pipeline(isolate); | |
1008 return CompileFunctionHelper(&pipeline, function, true, osr_id); | |
1009 } else { | |
1010 StandardCompilationPipeline pipeline; | |
1011 return CompileFunctionHelper(&pipeline, function, true, osr_id); | |
1012 } | |
909 } | 1013 } |
910 | 1014 |
911 | 1015 |
912 // This is only used from unit tests. | 1016 // This is only used from unit tests. |
913 RawError* Compiler::CompileParsedFunction( | 1017 RawError* Compiler::CompileParsedFunction( |
914 ParsedFunction* parsed_function) { | 1018 ParsedFunction* parsed_function) { |
915 Isolate* isolate = Isolate::Current(); | 1019 Isolate* isolate = Isolate::Current(); |
916 LongJumpScope jump; | 1020 LongJumpScope jump; |
917 if (setjmp(*jump.Set()) == 0) { | 1021 if (setjmp(*jump.Set()) == 0) { |
918 // Non-optimized code generator. | 1022 // Non-optimized code generator. |
919 CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId); | 1023 StandardCompilationPipeline pipeline; |
1024 CompileParsedFunctionHelper(&pipeline, | |
1025 parsed_function, | |
1026 false, | |
1027 Isolate::kNoDeoptId); | |
920 if (FLAG_disassemble) { | 1028 if (FLAG_disassemble) { |
921 DisassembleCode(parsed_function->function(), false); | 1029 DisassembleCode(parsed_function->function(), false); |
922 } | 1030 } |
923 return Error::null(); | 1031 return Error::null(); |
924 } else { | 1032 } else { |
925 Error& error = Error::Handle(); | 1033 Error& error = Error::Handle(); |
926 // We got an error during compilation. | 1034 // We got an error during compilation. |
927 error = isolate->object_store()->sticky_error(); | 1035 error = isolate->object_store()->sticky_error(); |
928 isolate->object_store()->clear_sticky_error(); | 1036 isolate->object_store()->clear_sticky_error(); |
929 return error.raw(); | 1037 return error.raw(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
986 ASSERT(field.value() == Object::transition_sentinel().raw()); | 1094 ASSERT(field.value() == Object::transition_sentinel().raw()); |
987 Isolate* isolate = Isolate::Current(); | 1095 Isolate* isolate = Isolate::Current(); |
988 StackZone zone(isolate); | 1096 StackZone zone(isolate); |
989 LongJumpScope jump; | 1097 LongJumpScope jump; |
990 if (setjmp(*jump.Set()) == 0) { | 1098 if (setjmp(*jump.Set()) == 0) { |
991 ParsedFunction* parsed_function = | 1099 ParsedFunction* parsed_function = |
992 Parser::ParseStaticFieldInitializer(field); | 1100 Parser::ParseStaticFieldInitializer(field); |
993 | 1101 |
994 parsed_function->AllocateVariables(); | 1102 parsed_function->AllocateVariables(); |
995 // Non-optimized code generator. | 1103 // Non-optimized code generator. |
996 CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId); | 1104 StandardCompilationPipeline pipeline; |
1105 CompileParsedFunctionHelper(&pipeline, | |
1106 parsed_function, | |
1107 false, | |
1108 Isolate::kNoDeoptId); | |
997 | 1109 |
998 // Invoke the function to evaluate the expression. | 1110 // Invoke the function to evaluate the expression. |
999 const Function& initializer = parsed_function->function(); | 1111 const Function& initializer = parsed_function->function(); |
1000 const Object& result = PassiveObject::Handle( | 1112 const Object& result = PassiveObject::Handle( |
1001 DartEntry::InvokeFunction(initializer, Object::empty_array())); | 1113 DartEntry::InvokeFunction(initializer, Object::empty_array())); |
1002 return result.raw(); | 1114 return result.raw(); |
1003 } else { | 1115 } else { |
1004 const Error& error = | 1116 const Error& error = |
1005 Error::Handle(isolate, isolate->object_store()->sticky_error()); | 1117 Error::Handle(isolate, isolate->object_store()->sticky_error()); |
1006 isolate->object_store()->clear_sticky_error(); | 1118 isolate->object_store()->clear_sticky_error(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1046 // would compile func automatically. We are checking fewer invariants | 1158 // would compile func automatically. We are checking fewer invariants |
1047 // here. | 1159 // here. |
1048 ParsedFunction* parsed_function = new ParsedFunction(isolate, func); | 1160 ParsedFunction* parsed_function = new ParsedFunction(isolate, func); |
1049 parsed_function->SetNodeSequence(fragment); | 1161 parsed_function->SetNodeSequence(fragment); |
1050 parsed_function->set_default_parameter_values(Object::null_array()); | 1162 parsed_function->set_default_parameter_values(Object::null_array()); |
1051 parsed_function->EnsureExpressionTemp(); | 1163 parsed_function->EnsureExpressionTemp(); |
1052 fragment->scope()->AddVariable(parsed_function->expression_temp_var()); | 1164 fragment->scope()->AddVariable(parsed_function->expression_temp_var()); |
1053 parsed_function->AllocateVariables(); | 1165 parsed_function->AllocateVariables(); |
1054 | 1166 |
1055 // Non-optimized code generator. | 1167 // Non-optimized code generator. |
1056 CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId); | 1168 StandardCompilationPipeline pipeline; |
1169 CompileParsedFunctionHelper(&pipeline, | |
1170 parsed_function, | |
1171 false, | |
1172 Isolate::kNoDeoptId); | |
1057 | 1173 |
1058 const Object& result = PassiveObject::Handle( | 1174 const Object& result = PassiveObject::Handle( |
1059 DartEntry::InvokeFunction(func, Object::empty_array())); | 1175 DartEntry::InvokeFunction(func, Object::empty_array())); |
1060 return result.raw(); | 1176 return result.raw(); |
1061 } else { | 1177 } else { |
1062 const Object& result = | 1178 const Object& result = |
1063 PassiveObject::Handle(isolate->object_store()->sticky_error()); | 1179 PassiveObject::Handle(isolate->object_store()->sticky_error()); |
1064 isolate->object_store()->clear_sticky_error(); | 1180 isolate->object_store()->clear_sticky_error(); |
1065 return result.raw(); | 1181 return result.raw(); |
1066 } | 1182 } |
1067 UNREACHABLE(); | 1183 UNREACHABLE(); |
1068 return Object::null(); | 1184 return Object::null(); |
1069 } | 1185 } |
1070 | 1186 |
1071 } // namespace dart | 1187 } // namespace dart |
OLD | NEW |