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