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

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

Issue 575443002: Refactor generating lazy deoptimization descriptors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/globals.h" // Needed here to get TARGET_ARCH_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/cha.h" 10 #include "vm/cha.h"
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 static_calls_target_table_.Add( 534 static_calls_target_table_.Add(
535 Smi::Handle(Smi::New(assembler()->CodeSize()))); 535 Smi::Handle(Smi::New(assembler()->CodeSize())));
536 ASSERT(Code::kSCallTableFunctionEntry == 1); 536 ASSERT(Code::kSCallTableFunctionEntry == 1);
537 static_calls_target_table_.Add(func); 537 static_calls_target_table_.Add(func);
538 ASSERT(Code::kSCallTableCodeEntry == 2); 538 ASSERT(Code::kSCallTableCodeEntry == 2);
539 static_calls_target_table_.Add(Code::Handle()); 539 static_calls_target_table_.Add(Code::Handle());
540 } 540 }
541 541
542 542
543 void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id, 543 void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id,
544 intptr_t token_pos) { 544 intptr_t token_pos,
545 intptr_t input_count) {
545 ASSERT(is_optimizing()); 546 ASSERT(is_optimizing());
546 ASSERT(!intrinsic_mode()); 547 ASSERT(!intrinsic_mode());
548 Environment* env = pending_deoptimization_env_->DeepCopy(
549 isolate(), pending_deoptimization_env_->Length() - input_count);
547 CompilerDeoptInfo* info = 550 CompilerDeoptInfo* info =
548 new CompilerDeoptInfo(deopt_id, 551 new CompilerDeoptInfo(deopt_id,
549 ICData::kDeoptAtCall, 552 ICData::kDeoptAtCall,
550 pending_deoptimization_env_); 553 env);
551 info->set_pc_offset(assembler()->CodeSize()); 554 info->set_pc_offset(assembler()->CodeSize());
552 deopt_infos_.Add(info); 555 deopt_infos_.Add(info);
553 } 556 }
554 557
555 558
556 // This function must be in sync with FlowGraphCompiler::SaveLiveRegisters 559 // This function must be in sync with FlowGraphCompiler::SaveLiveRegisters
557 // and FlowGraphCompiler::SlowPathEnvironmentFor. 560 // and FlowGraphCompiler::SlowPathEnvironmentFor.
558 void FlowGraphCompiler::RecordSafepoint(LocationSummary* locs) { 561 void FlowGraphCompiler::RecordSafepoint(LocationSummary* locs) {
559 if (is_optimizing()) { 562 if (is_optimizing()) {
560 RegisterSet* registers = locs->live_registers(); 563 RegisterSet* registers = locs->live_registers();
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 // "Deoptimization" from intrinsic continues here. All deoptimization 868 // "Deoptimization" from intrinsic continues here. All deoptimization
866 // branches from intrinsic code redirect to here where the slow-path 869 // branches from intrinsic code redirect to here where the slow-path
867 // (normal function body) starts. 870 // (normal function body) starts.
868 // This means that there must not be any side-effects in intrinsic code 871 // This means that there must not be any side-effects in intrinsic code
869 // before any deoptimization point. 872 // before any deoptimization point.
870 ASSERT(!intrinsic_slow_path_label_.IsBound()); 873 ASSERT(!intrinsic_slow_path_label_.IsBound());
871 assembler()->Bind(&intrinsic_slow_path_label_); 874 assembler()->Bind(&intrinsic_slow_path_label_);
872 } 875 }
873 876
874 877
878 // Record safe point and deoptimization info if applicable.
879 void FlowGraphCompiler::RecordCallInfo(intptr_t token_pos,
880 RawPcDescriptors::Kind kind,
881 intptr_t deopt_id,
882 LocationSummary* locs,
883 intptr_t input_count_adjustment) {
884 AddCurrentDescriptor(kind, deopt_id, token_pos);
885 RecordSafepoint(locs);
886 if (deopt_id != Isolate::kNoDeoptId) {
887 // Marks either the continuation point in unoptimized code or the
888 // deoptimization point in optimized code, after call.
889 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id);
890 if (is_optimizing()) {
891 AddDeoptIndexAtCall(deopt_id_after, token_pos, input_count_adjustment);
892 } else {
893 // Add deoptimization continuation point after the call and before the
894 // arguments are removed.
895 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
896 }
897 }
898 }
899
900
875 void FlowGraphCompiler::GenerateInstanceCall( 901 void FlowGraphCompiler::GenerateInstanceCall(
876 intptr_t deopt_id, 902 intptr_t deopt_id,
877 intptr_t token_pos, 903 intptr_t token_pos,
878 intptr_t argument_count, 904 intptr_t argument_count,
879 LocationSummary* locs, 905 LocationSummary* locs,
880 const ICData& ic_data) { 906 const ICData& ic_data) {
881 ASSERT(!ic_data.IsNull()); 907 ASSERT(!ic_data.IsNull());
882 ASSERT(FLAG_propagate_ic_data || (ic_data.NumberOfUsedChecks() == 0)); 908 ASSERT(FLAG_propagate_ic_data || (ic_data.NumberOfUsedChecks() == 0));
883 uword label_address = 0; 909 uword label_address = 0;
884 StubCode* stub_code = isolate()->stub_code(); 910 StubCode* stub_code = isolate()->stub_code();
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 threshold = FLAG_optimization_counter_scale * basic_blocks + 1496 threshold = FLAG_optimization_counter_scale * basic_blocks +
1471 FLAG_min_optimization_counter_threshold; 1497 FLAG_min_optimization_counter_threshold;
1472 if (threshold > FLAG_optimization_counter_threshold) { 1498 if (threshold > FLAG_optimization_counter_threshold) {
1473 threshold = FLAG_optimization_counter_threshold; 1499 threshold = FLAG_optimization_counter_threshold;
1474 } 1500 }
1475 } 1501 }
1476 return threshold; 1502 return threshold;
1477 } 1503 }
1478 1504
1479 } // namespace dart 1505 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698