| 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" |  | 
| 34 #include "vm/scanner.h" | 32 #include "vm/scanner.h" | 
| 35 #include "vm/symbols.h" | 33 #include "vm/symbols.h" | 
| 36 #include "vm/tags.h" | 34 #include "vm/tags.h" | 
| 37 #include "vm/timer.h" | 35 #include "vm/timer.h" | 
| 38 | 36 | 
| 39 namespace dart { | 37 namespace dart { | 
| 40 | 38 | 
| 41 DEFINE_FLAG(bool, allocation_sinking, true, | 39 DEFINE_FLAG(bool, allocation_sinking, true, | 
| 42     "Attempt to sink temporary allocations to side exits"); | 40     "Attempt to sink temporary allocations to side exits"); | 
| 43 DEFINE_FLAG(bool, common_subexpression_elimination, true, | 41 DEFINE_FLAG(bool, common_subexpression_elimination, true, | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 58 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); | 56 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); | 
| 59 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering."); | 57 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering."); | 
| 60 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); | 58 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); | 
| 61 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); | 59 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); | 
| 62 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); | 60 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); | 
| 63 DEFINE_FLAG(bool, verify_compiler, false, | 61 DEFINE_FLAG(bool, verify_compiler, false, | 
| 64     "Enable compiler verification assertions"); | 62     "Enable compiler verification assertions"); | 
| 65 | 63 | 
| 66 DECLARE_FLAG(bool, trace_failed_optimization_attempts); | 64 DECLARE_FLAG(bool, trace_failed_optimization_attempts); | 
| 67 DECLARE_FLAG(bool, trace_patching); | 65 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     : backtrack_goto_(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     backtrack_goto_ = result.backtrack_goto; |  | 
| 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     backtrack_goto_->ComputeOffsetTable(isolate_); |  | 
| 148   } |  | 
| 149 |  | 
| 150  private: |  | 
| 151   IndirectGotoInstr* backtrack_goto_; |  | 
| 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 |  | 
| 164 | 66 | 
| 165 // Compile a function. Should call only if the function has not been compiled. | 67 // Compile a function. Should call only if the function has not been compiled. | 
| 166 //   Arg0: function object. | 68 //   Arg0: function object. | 
| 167 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { | 69 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { | 
| 168   const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); | 70   const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); | 
| 169   ASSERT(!function.HasCode()); | 71   ASSERT(!function.HasCode()); | 
| 170   const Error& error = Error::Handle(Compiler::CompileFunction(isolate, | 72   const Error& error = Error::Handle(Compiler::CompileFunction(isolate, | 
| 171                                                                function)); | 73                                                                function)); | 
| 172   if (!error.IsNull()) { | 74   if (!error.IsNull()) { | 
| 173     Exceptions::PropagateError(error); | 75     Exceptions::PropagateError(error); | 
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 355     error = isolate->object_store()->sticky_error(); | 257     error = isolate->object_store()->sticky_error(); | 
| 356     isolate->object_store()->clear_sticky_error(); | 258     isolate->object_store()->clear_sticky_error(); | 
| 357     return error.raw(); | 259     return error.raw(); | 
| 358   } | 260   } | 
| 359   UNREACHABLE(); | 261   UNREACHABLE(); | 
| 360   return Error::null(); | 262   return Error::null(); | 
| 361 } | 263 } | 
| 362 | 264 | 
| 363 | 265 | 
| 364 // Return false if bailed out. | 266 // Return false if bailed out. | 
| 365 static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline, | 267 static bool CompileParsedFunctionHelper(ParsedFunction* parsed_function, | 
| 366                                         ParsedFunction* parsed_function, |  | 
| 367                                         bool optimized, | 268                                         bool optimized, | 
| 368                                         intptr_t osr_id) { | 269                                         intptr_t osr_id) { | 
| 369   const Function& function = parsed_function->function(); | 270   const Function& function = parsed_function->function(); | 
| 370   if (optimized && !function.IsOptimizable()) { | 271   if (optimized && !function.IsOptimizable()) { | 
| 371     return false; | 272     return false; | 
| 372   } | 273   } | 
| 373   TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); | 274   TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); | 
| 374   bool is_compiled = false; | 275   bool is_compiled = false; | 
| 375   Isolate* isolate = Isolate::Current(); | 276   Isolate* isolate = Isolate::Current(); | 
| 376   HANDLESCOPE(isolate); | 277   HANDLESCOPE(isolate); | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 413           if (FLAG_print_ic_data_map) { | 314           if (FLAG_print_ic_data_map) { | 
| 414             for (intptr_t i = 0; i < ic_data_array->length(); i++) { | 315             for (intptr_t i = 0; i < ic_data_array->length(); i++) { | 
| 415               if ((*ic_data_array)[i] != NULL) { | 316               if ((*ic_data_array)[i] != NULL) { | 
| 416                 OS::Print("%" Pd " ", i); | 317                 OS::Print("%" Pd " ", i); | 
| 417                 FlowGraphPrinter::PrintICData(*(*ic_data_array)[i]); | 318                 FlowGraphPrinter::PrintICData(*(*ic_data_array)[i]); | 
| 418               } | 319               } | 
| 419             } | 320             } | 
| 420           } | 321           } | 
| 421         } | 322         } | 
| 422 | 323 | 
| 423         flow_graph = pipeline->BuildFlowGraph(parsed_function, | 324         // Build the flow graph. | 
| 424                                               *ic_data_array, | 325         FlowGraphBuilder builder(parsed_function, | 
| 425                                               osr_id); | 326                                  *ic_data_array, | 
|  | 327                                  NULL,  // NULL = not inlining. | 
|  | 328                                  osr_id); | 
|  | 329         flow_graph = builder.BuildGraph(); | 
| 426       } | 330       } | 
| 427 | 331 | 
| 428       if (FLAG_print_flow_graph || | 332       if (FLAG_print_flow_graph || | 
| 429           (optimized && FLAG_print_flow_graph_optimized)) { | 333           (optimized && FLAG_print_flow_graph_optimized)) { | 
| 430         if (osr_id == Isolate::kNoDeoptId) { | 334         if (osr_id == Isolate::kNoDeoptId) { | 
| 431           FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph); | 335           FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph); | 
| 432         } else { | 336         } else { | 
| 433           FlowGraphPrinter::PrintGraph("For OSR", flow_graph); | 337           FlowGraphPrinter::PrintGraph("For OSR", flow_graph); | 
| 434         } | 338         } | 
| 435       } | 339       } | 
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 672         } | 576         } | 
| 673       } | 577       } | 
| 674 | 578 | 
| 675       Assembler assembler(use_far_branches); | 579       Assembler assembler(use_far_branches); | 
| 676       FlowGraphCompiler graph_compiler(&assembler, flow_graph, optimized); | 580       FlowGraphCompiler graph_compiler(&assembler, flow_graph, optimized); | 
| 677       { | 581       { | 
| 678         TimerScope timer(FLAG_compiler_stats, | 582         TimerScope timer(FLAG_compiler_stats, | 
| 679                          &CompilerStats::graphcompiler_timer, | 583                          &CompilerStats::graphcompiler_timer, | 
| 680                          isolate); | 584                          isolate); | 
| 681         graph_compiler.CompileGraph(); | 585         graph_compiler.CompileGraph(); | 
| 682         pipeline->FinalizeCompilation(); |  | 
| 683       } | 586       } | 
| 684       { | 587       { | 
| 685         TimerScope timer(FLAG_compiler_stats, | 588         TimerScope timer(FLAG_compiler_stats, | 
| 686                          &CompilerStats::codefinalizer_timer, | 589                          &CompilerStats::codefinalizer_timer, | 
| 687                          isolate); | 590                          isolate); | 
| 688         const Code& code = Code::Handle( | 591         const Code& code = Code::Handle( | 
| 689             Code::FinalizeCode(function, &assembler, optimized)); | 592             Code::FinalizeCode(function, &assembler, optimized)); | 
| 690         code.set_is_optimized(optimized); | 593         code.set_is_optimized(optimized); | 
| 691         graph_compiler.FinalizePcDescriptors(code); | 594         graph_compiler.FinalizePcDescriptors(code); | 
| 692         graph_compiler.FinalizeDeoptInfo(code); | 595         graph_compiler.FinalizeDeoptInfo(code); | 
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 905             start + offset.Value(), | 808             start + offset.Value(), | 
| 906             function.ToFullyQualifiedCString(), | 809             function.ToFullyQualifiedCString(), | 
| 907             code.raw()); | 810             code.raw()); | 
| 908       } | 811       } | 
| 909     } | 812     } | 
| 910     OS::Print("}\n"); | 813     OS::Print("}\n"); | 
| 911   } | 814   } | 
| 912 } | 815 } | 
| 913 | 816 | 
| 914 | 817 | 
| 915 static RawError* CompileFunctionHelper(CompilationPipeline* pipeline, | 818 static RawError* CompileFunctionHelper(const Function& function, | 
| 916                                        const Function& function, |  | 
| 917                                        bool optimized, | 819                                        bool optimized, | 
| 918                                        intptr_t osr_id) { | 820                                        intptr_t osr_id) { | 
| 919   Isolate* isolate = Isolate::Current(); | 821   Isolate* isolate = Isolate::Current(); | 
| 920   StackZone zone(isolate); | 822   StackZone zone(isolate); | 
| 921   LongJumpScope jump; | 823   LongJumpScope jump; | 
| 922   if (setjmp(*jump.Set()) == 0) { | 824   if (setjmp(*jump.Set()) == 0) { | 
| 923     TIMERSCOPE(isolate, time_compilation); | 825     TIMERSCOPE(isolate, time_compilation); | 
| 924     Timer per_compile_timer(FLAG_trace_compiler, "Compilation time"); | 826     Timer per_compile_timer(FLAG_trace_compiler, "Compilation time"); | 
| 925     per_compile_timer.Start(); | 827     per_compile_timer.Start(); | 
| 926     ParsedFunction* parsed_function = new(isolate) ParsedFunction( | 828     ParsedFunction* parsed_function = new(isolate) ParsedFunction( | 
| 927         isolate, Function::ZoneHandle(isolate, function.raw())); | 829         isolate, Function::ZoneHandle(isolate, function.raw())); | 
| 928     if (FLAG_trace_compiler) { | 830     if (FLAG_trace_compiler) { | 
| 929       OS::Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n", | 831       OS::Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n", | 
| 930                 (osr_id == Isolate::kNoDeoptId ? "" : "osr "), | 832                 (osr_id == Isolate::kNoDeoptId ? "" : "osr "), | 
| 931                 (optimized ? "optimized " : ""), | 833                 (optimized ? "optimized " : ""), | 
| 932                 function.ToFullyQualifiedCString(), | 834                 function.ToFullyQualifiedCString(), | 
| 933                 function.token_pos(), | 835                 function.token_pos(), | 
| 934                 (function.end_token_pos() - function.token_pos())); | 836                 (function.end_token_pos() - function.token_pos())); | 
| 935     } | 837     } | 
| 936     { | 838     { | 
| 937       HANDLESCOPE(isolate); | 839       HANDLESCOPE(isolate); | 
| 938       pipeline->ParseFunction(parsed_function); | 840       Parser::ParseFunction(parsed_function); | 
|  | 841       parsed_function->AllocateVariables(); | 
| 939     } | 842     } | 
| 940 | 843 | 
| 941     const bool success = CompileParsedFunctionHelper(pipeline, | 844     const bool success = | 
| 942                                                      parsed_function, | 845         CompileParsedFunctionHelper(parsed_function, optimized, osr_id); | 
| 943                                                      optimized, |  | 
| 944                                                      osr_id); |  | 
| 945     if (!success) { | 846     if (!success) { | 
| 946       if (optimized) { | 847       if (optimized) { | 
| 947         // Optimizer bailed out. Disable optimizations and to never try again. | 848         // Optimizer bailed out. Disable optimizations and to never try again. | 
| 948         if (FLAG_trace_compiler) { | 849         if (FLAG_trace_compiler) { | 
| 949           OS::Print("--> disabling optimizations for '%s'\n", | 850           OS::Print("--> disabling optimizations for '%s'\n", | 
| 950                     function.ToFullyQualifiedCString()); | 851                     function.ToFullyQualifiedCString()); | 
| 951         } else if (FLAG_trace_failed_optimization_attempts) { | 852         } else if (FLAG_trace_failed_optimization_attempts) { | 
| 952           OS::Print("Cannot optimize: %s\n", | 853           OS::Print("Cannot optimize: %s\n", | 
| 953                     function.ToFullyQualifiedCString()); | 854                     function.ToFullyQualifiedCString()); | 
| 954         } | 855         } | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 988     return error.raw(); | 889     return error.raw(); | 
| 989   } | 890   } | 
| 990   UNREACHABLE(); | 891   UNREACHABLE(); | 
| 991   return Error::null(); | 892   return Error::null(); | 
| 992 } | 893 } | 
| 993 | 894 | 
| 994 | 895 | 
| 995 RawError* Compiler::CompileFunction(Isolate* isolate, | 896 RawError* Compiler::CompileFunction(Isolate* isolate, | 
| 996                                     const Function& function) { | 897                                     const Function& function) { | 
| 997   VMTagScope tagScope(isolate, VMTag::kCompileUnoptimizedTagId); | 898   VMTagScope tagScope(isolate, VMTag::kCompileUnoptimizedTagId); | 
| 998   CompilationPipeline* pipeline = CompilationPipeline::New(isolate, function); | 899   return CompileFunctionHelper(function, false, Isolate::kNoDeoptId); | 
| 999   return CompileFunctionHelper(pipeline, function, false, Isolate::kNoDeoptId); |  | 
| 1000 } | 900 } | 
| 1001 | 901 | 
| 1002 | 902 | 
| 1003 RawError* Compiler::CompileOptimizedFunction(Isolate* isolate, | 903 RawError* Compiler::CompileOptimizedFunction(Isolate* isolate, | 
| 1004                                              const Function& function, | 904                                              const Function& function, | 
| 1005                                              intptr_t osr_id) { | 905                                              intptr_t osr_id) { | 
| 1006   VMTagScope tagScope(isolate, VMTag::kCompileOptimizedTagId); | 906   VMTagScope tagScope(isolate, VMTag::kCompileOptimizedTagId); | 
| 1007   CompilationPipeline* pipeline = CompilationPipeline::New(isolate, function); | 907   return CompileFunctionHelper(function, true, osr_id); | 
| 1008   return CompileFunctionHelper(pipeline, function, true, osr_id); |  | 
| 1009 } | 908 } | 
| 1010 | 909 | 
| 1011 | 910 | 
| 1012 // This is only used from unit tests. | 911 // This is only used from unit tests. | 
| 1013 RawError* Compiler::CompileParsedFunction( | 912 RawError* Compiler::CompileParsedFunction( | 
| 1014     ParsedFunction* parsed_function) { | 913     ParsedFunction* parsed_function) { | 
| 1015   Isolate* isolate = Isolate::Current(); | 914   Isolate* isolate = Isolate::Current(); | 
| 1016   LongJumpScope jump; | 915   LongJumpScope jump; | 
| 1017   if (setjmp(*jump.Set()) == 0) { | 916   if (setjmp(*jump.Set()) == 0) { | 
| 1018     // Non-optimized code generator. | 917     // Non-optimized code generator. | 
| 1019     DartCompilationPipeline pipeline; | 918     CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId); | 
| 1020     CompileParsedFunctionHelper(&pipeline, |  | 
| 1021                                 parsed_function, |  | 
| 1022                                 false, |  | 
| 1023                                 Isolate::kNoDeoptId); |  | 
| 1024     if (FLAG_disassemble) { | 919     if (FLAG_disassemble) { | 
| 1025       DisassembleCode(parsed_function->function(), false); | 920       DisassembleCode(parsed_function->function(), false); | 
| 1026     } | 921     } | 
| 1027     return Error::null(); | 922     return Error::null(); | 
| 1028   } else { | 923   } else { | 
| 1029     Error& error = Error::Handle(); | 924     Error& error = Error::Handle(); | 
| 1030     // We got an error during compilation. | 925     // We got an error during compilation. | 
| 1031     error = isolate->object_store()->sticky_error(); | 926     error = isolate->object_store()->sticky_error(); | 
| 1032     isolate->object_store()->clear_sticky_error(); | 927     isolate->object_store()->clear_sticky_error(); | 
| 1033     return error.raw(); | 928     return error.raw(); | 
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1090   ASSERT(field.value() == Object::transition_sentinel().raw()); | 985   ASSERT(field.value() == Object::transition_sentinel().raw()); | 
| 1091   Isolate* isolate = Isolate::Current(); | 986   Isolate* isolate = Isolate::Current(); | 
| 1092   StackZone zone(isolate); | 987   StackZone zone(isolate); | 
| 1093   LongJumpScope jump; | 988   LongJumpScope jump; | 
| 1094   if (setjmp(*jump.Set()) == 0) { | 989   if (setjmp(*jump.Set()) == 0) { | 
| 1095     ParsedFunction* parsed_function = | 990     ParsedFunction* parsed_function = | 
| 1096         Parser::ParseStaticFieldInitializer(field); | 991         Parser::ParseStaticFieldInitializer(field); | 
| 1097 | 992 | 
| 1098     parsed_function->AllocateVariables(); | 993     parsed_function->AllocateVariables(); | 
| 1099     // Non-optimized code generator. | 994     // Non-optimized code generator. | 
| 1100     DartCompilationPipeline pipeline; | 995     CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId); | 
| 1101     CompileParsedFunctionHelper(&pipeline, |  | 
| 1102                                 parsed_function, |  | 
| 1103                                 false, |  | 
| 1104                                 Isolate::kNoDeoptId); |  | 
| 1105 | 996 | 
| 1106     // Invoke the function to evaluate the expression. | 997     // Invoke the function to evaluate the expression. | 
| 1107     const Function& initializer = parsed_function->function(); | 998     const Function& initializer = parsed_function->function(); | 
| 1108     const Object& result = PassiveObject::Handle( | 999     const Object& result = PassiveObject::Handle( | 
| 1109         DartEntry::InvokeFunction(initializer, Object::empty_array())); | 1000         DartEntry::InvokeFunction(initializer, Object::empty_array())); | 
| 1110     return result.raw(); | 1001     return result.raw(); | 
| 1111   } else { | 1002   } else { | 
| 1112     const Error& error = | 1003     const Error& error = | 
| 1113         Error::Handle(isolate, isolate->object_store()->sticky_error()); | 1004         Error::Handle(isolate, isolate->object_store()->sticky_error()); | 
| 1114     isolate->object_store()->clear_sticky_error(); | 1005     isolate->object_store()->clear_sticky_error(); | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1155     // here. | 1046     // here. | 
| 1156     ParsedFunction* parsed_function = new ParsedFunction(isolate, func); | 1047     ParsedFunction* parsed_function = new ParsedFunction(isolate, func); | 
| 1157     parsed_function->SetNodeSequence(fragment); | 1048     parsed_function->SetNodeSequence(fragment); | 
| 1158     parsed_function->set_default_parameter_values(Object::null_array()); | 1049     parsed_function->set_default_parameter_values(Object::null_array()); | 
| 1159     fragment->scope()->AddVariable(parsed_function->EnsureExpressionTemp()); | 1050     fragment->scope()->AddVariable(parsed_function->EnsureExpressionTemp()); | 
| 1160     fragment->scope()->AddVariable( | 1051     fragment->scope()->AddVariable( | 
| 1161         parsed_function->current_context_var()); | 1052         parsed_function->current_context_var()); | 
| 1162     parsed_function->AllocateVariables(); | 1053     parsed_function->AllocateVariables(); | 
| 1163 | 1054 | 
| 1164     // Non-optimized code generator. | 1055     // Non-optimized code generator. | 
| 1165     DartCompilationPipeline pipeline; | 1056     CompileParsedFunctionHelper(parsed_function, false, Isolate::kNoDeoptId); | 
| 1166     CompileParsedFunctionHelper(&pipeline, |  | 
| 1167                                 parsed_function, |  | 
| 1168                                 false, |  | 
| 1169                                 Isolate::kNoDeoptId); |  | 
| 1170 | 1057 | 
| 1171     const Object& result = PassiveObject::Handle( | 1058     const Object& result = PassiveObject::Handle( | 
| 1172         DartEntry::InvokeFunction(func, Object::empty_array())); | 1059         DartEntry::InvokeFunction(func, Object::empty_array())); | 
| 1173     return result.raw(); | 1060     return result.raw(); | 
| 1174   } else { | 1061   } else { | 
| 1175     const Object& result = | 1062     const Object& result = | 
| 1176       PassiveObject::Handle(isolate->object_store()->sticky_error()); | 1063       PassiveObject::Handle(isolate->object_store()->sticky_error()); | 
| 1177     isolate->object_store()->clear_sticky_error(); | 1064     isolate->object_store()->clear_sticky_error(); | 
| 1178     return result.raw(); | 1065     return result.raw(); | 
| 1179   } | 1066   } | 
| 1180   UNREACHABLE(); | 1067   UNREACHABLE(); | 
| 1181   return Object::null(); | 1068   return Object::null(); | 
| 1182 } | 1069 } | 
| 1183 | 1070 | 
| 1184 }  // namespace dart | 1071 }  // namespace dart | 
| OLD | NEW | 
|---|