Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: runtime/vm/compiler.cc

Issue 1211273011: Added full deferred loading semantic to precompiled/--noopt/eager-loading code (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: c Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/compiler.h ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 DEFINE_FLAG(bool, print_ic_data_map, false, 57 DEFINE_FLAG(bool, print_ic_data_map, false,
58 "Print the deopt-id to ICData map in optimizing compiler."); 58 "Print the deopt-id to ICData map in optimizing compiler.");
59 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis"); 59 DEFINE_FLAG(bool, range_analysis, true, "Enable range analysis");
60 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering."); 60 DEFINE_FLAG(bool, reorder_basic_blocks, true, "Enable basic-block reordering.");
61 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations."); 61 DEFINE_FLAG(bool, trace_compiler, false, "Trace compiler operations.");
62 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler."); 62 DEFINE_FLAG(bool, trace_bailout, false, "Print bailout from ssa compiler.");
63 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining"); 63 DEFINE_FLAG(bool, use_inlining, true, "Enable call-site inlining");
64 DEFINE_FLAG(bool, verify_compiler, false, 64 DEFINE_FLAG(bool, verify_compiler, false,
65 "Enable compiler verification assertions"); 65 "Enable compiler verification assertions");
66 66
67 DECLARE_FLAG(bool, load_deferred_eagerly);
67 DECLARE_FLAG(bool, trace_failed_optimization_attempts); 68 DECLARE_FLAG(bool, trace_failed_optimization_attempts);
68 DECLARE_FLAG(bool, trace_inlining_intervals); 69 DECLARE_FLAG(bool, trace_inlining_intervals);
69 DECLARE_FLAG(bool, trace_irregexp); 70 DECLARE_FLAG(bool, trace_irregexp);
70 DECLARE_FLAG(bool, trace_patching); 71 DECLARE_FLAG(bool, trace_patching);
71 72
72 73
73 bool Compiler::always_optimize_ = false; 74 bool Compiler::always_optimize_ = false;
75 bool Compiler::allow_recompilation_ = true;
74 76
75 77
76 // TODO(zerny): Factor out unoptimizing/optimizing pipelines and remove 78 // TODO(zerny): Factor out unoptimizing/optimizing pipelines and remove
77 // separate helpers functions & `optimizing` args. 79 // separate helpers functions & `optimizing` args.
78 class CompilationPipeline : public ZoneAllocated { 80 class CompilationPipeline : public ZoneAllocated {
79 public: 81 public:
80 static CompilationPipeline* New(Zone* zone, const Function& function); 82 static CompilationPipeline* New(Zone* zone, const Function& function);
81 83
82 virtual void ParseFunction(ParsedFunction* parsed_function) = 0; 84 virtual void ParseFunction(ParsedFunction* parsed_function) = 0;
83 virtual FlowGraph* BuildFlowGraph( 85 virtual FlowGraph* BuildFlowGraph(
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 } else { // not optimized. 783 } else { // not optimized.
782 if (!Compiler::always_optimize() && 784 if (!Compiler::always_optimize() &&
783 (function.ic_data_array() == Array::null())) { 785 (function.ic_data_array() == Array::null())) {
784 function.SaveICDataMap(graph_compiler.deopt_id_to_ic_data()); 786 function.SaveICDataMap(graph_compiler.deopt_id_to_ic_data());
785 } 787 }
786 function.set_unoptimized_code(code); 788 function.set_unoptimized_code(code);
787 function.AttachCode(code); 789 function.AttachCode(code);
788 ASSERT(CodePatcher::CodeIsPatchable(code)); 790 ASSERT(CodePatcher::CodeIsPatchable(code));
789 } 791 }
790 if (parsed_function->HasDeferredPrefixes()) { 792 if (parsed_function->HasDeferredPrefixes()) {
793 ASSERT(!FLAG_load_deferred_eagerly);
791 ZoneGrowableArray<const LibraryPrefix*>* prefixes = 794 ZoneGrowableArray<const LibraryPrefix*>* prefixes =
792 parsed_function->deferred_prefixes(); 795 parsed_function->deferred_prefixes();
793 for (intptr_t i = 0; i < prefixes->length(); i++) { 796 for (intptr_t i = 0; i < prefixes->length(); i++) {
794 (*prefixes)[i]->RegisterDependentCode(code); 797 (*prefixes)[i]->RegisterDependentCode(code);
795 } 798 }
796 } 799 }
797 } 800 }
798 // Mark that this isolate now has compiled code. 801 // Mark that this isolate now has compiled code.
799 isolate->set_has_compiled(true); 802 isolate->set_has_compiled(true);
800 // Exit the loop and the function with the correct result value. 803 // Exit the loop and the function with the correct result value.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 if (optimized && FLAG_trace_inlining_intervals) { 968 if (optimized && FLAG_trace_inlining_intervals) {
966 code.DumpInlinedIntervals(); 969 code.DumpInlinedIntervals();
967 } 970 }
968 } 971 }
969 972
970 973
971 static RawError* CompileFunctionHelper(CompilationPipeline* pipeline, 974 static RawError* CompileFunctionHelper(CompilationPipeline* pipeline,
972 const Function& function, 975 const Function& function,
973 bool optimized, 976 bool optimized,
974 intptr_t osr_id) { 977 intptr_t osr_id) {
978 // Check that we optimize if 'Compiler::always_optimize()' is set to true,
979 // except if the function is marked as not optimizable.
980 ASSERT(!function.IsOptimizable() ||
981 !Compiler::always_optimize() || optimized);
982 ASSERT(Compiler::allow_recompilation() || !function.HasCode());
975 LongJumpScope jump; 983 LongJumpScope jump;
976 if (setjmp(*jump.Set()) == 0) { 984 if (setjmp(*jump.Set()) == 0) {
977 Thread* const thread = Thread::Current(); 985 Thread* const thread = Thread::Current();
978 Isolate* const isolate = thread->isolate(); 986 Isolate* const isolate = thread->isolate();
979 StackZone stack_zone(isolate); 987 StackZone stack_zone(isolate);
980 Zone* const zone = stack_zone.GetZone(); 988 Zone* const zone = stack_zone.GetZone();
981 TIMERSCOPE(isolate, time_compilation); 989 TIMERSCOPE(isolate, time_compilation);
982 Timer per_compile_timer(FLAG_trace_compiler, "Compilation time"); 990 Timer per_compile_timer(FLAG_trace_compiler, "Compilation time");
983 per_compile_timer.Start(); 991 per_compile_timer.Start();
984 992
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 const Object& result = 1342 const Object& result =
1335 PassiveObject::Handle(isolate->object_store()->sticky_error()); 1343 PassiveObject::Handle(isolate->object_store()->sticky_error());
1336 isolate->object_store()->clear_sticky_error(); 1344 isolate->object_store()->clear_sticky_error();
1337 return result.raw(); 1345 return result.raw();
1338 } 1346 }
1339 UNREACHABLE(); 1347 UNREACHABLE();
1340 return Object::null(); 1348 return Object::null();
1341 } 1349 }
1342 1350
1343 } // namespace dart 1351 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.h ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698